Prev: Why can't I catch a SIGBUS on my Mac (when strlen(NULL) is used)?
Next: ANN: Seed7 Release 2010-04-04
From: Vandana on 4 Apr 2010 15:24 Hello, Can I use pthread_cond_wait & pthread_signal for IPC? I am using fork to create 2 process. Can I use pthread_cond_wait & pthread_signal to stall one of the process until the condition is set by the other? Thanks, Vandana
From: David Schwartz on 5 Apr 2010 02:46
On Apr 4, 12:24 pm, Vandana <nair...(a)gmail.com> wrote: > Hello, > > Can I use pthread_cond_wait & pthread_signal for IPC? > > I am using fork to create 2 process. Can I use pthread_cond_wait & > pthread_signal to stall one of the process until the condition is set > by the other? Yes, just don't forget these things: 1) The mutex and condition variable must be set up in shared memory. 2) The mutex and condition variable must be set process shared when they are initialized. 3) You must implement the condition that will be set yourself. Functions like "pthread_cond_wait" are, despite their name, *not* conditional waits. They are unconditional waits *for* a condition -- a condition that you must implement. DS |