Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: OT: Locking and syncing mechanisms available on *nix.

by nikosv (Hermit)
on Mar 27, 2011 at 09:04 UTC ( #895738=note: print w/ replies, xml ) Need Help??


in reply to OT: Locking and syncing mechanisms available on *nix.

there are mutexes as well

On windows, I have a whole range of these mechanisms available

also if you look at a higher level there is the SynchronizationContext


Comment on Re: OT: Locking and syncing mechanisms available on *nix.
Re^2: OT: Locking and syncing mechanisms available on *nix.
by BrowserUk (Pope) on Mar 27, 2011 at 09:37 UTC

    Sorry. I misread your post. Due to the formatting, I read your response as there are mutexes as well On windows,.

    Also, I'm not sure what use the second link was?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Also, I'm not sure what use the second link was?

      It's what is behind the BackgroundWorker component.

      I've posted it here just for informational purposes,looking at an alternative concept-wise,since it is releated to windows and threading

        Ah. Okay. I don't use, nor have any time for the O'Woe dodo that is .NET, so that's of no use to me.

        What I'm really looking for (I think) is a *nix equivalent to Windows Event Objects. Basically, a non-polling, non-spinning mechanism to have one thread block until another thread signals.

        In theory, pthread condition variables ought to be usable for this. In practice, using a condition variable also requires the use of a mutex, which I don't need or want. I'm not trying to mutually exclude anything. Nor do I see a convenient place to put a mutex that I don't need.

        I've run across a few mentions of something called a "futex" which is compared to Window's Event objects, but looking that term up it is defined as a 'fast user mutex'. Again, I'm not trying to mutually exclude anything!

        The situation I'm trying to deal with would seem to be a relatively common occurrence. This thread has detected a situation that means it cannot proceed until some other thread does something. It therefore need to block until that other thread signals that it has been done. So, it reset an event and waits for it to be signalled. The other thread signals that event each time it does whatever it is required to do to allow the first thread to move forward.

        But I don't see how to do this with *nix?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://895738]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-09-22 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (185 votes), past polls