Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.

In reply to Re^4: OT: Locking and syncing mechanisms available on *nix. by BrowserUk
in thread OT: Locking and syncing mechanisms available on *nix. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (9)
As of 2024-04-23 11:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found