Blocking cond_signal?
[email protected] Tue, 19 Dec 2006 15:24:06 -0600 (CST)
| Newsgroups | perl.ithreads |
|---|---|
| Message-ID | <[email protected]> |
Hey all- I've been lurking this list (via the archives) for a while now for help writing threaded programs. You've been a really good resource, but I've run into a snag that I can't quite figure out. In my application, I need a thread to wait on another thread to send a cond_signal. Easy enough, but if the second thread hasn't reached the cond_wait by the time the cond_signal appears, then the signal is discarded and the cond_wait will end up blocking forever. The POD reads: "By always locking before signaling, you can (with care), avoid signaling before another thread has entered cond_wait()" But every scheme I've attempted ensure this has been racy and fragile. Could someone please shed light on this? Thanks in advance- Andrew