Subj : Re: signaling threads from a forked child? To : comp.programming.threads From : Joe Seigh Date : Fri Aug 05 2005 07:52 am markh@compro.net wrote: > I'm attempting to use pthread_cond_signal in the child directed to a > particular thread using the parents Mutex and cond variable. I've used > the pthread_atfork call to insure the child has initialized it's copy > of the Mutex and cond variable. I gues thats the real issue here. The > childs copy of the Mutex and cond variable are not the same physical > memory as the parents and parents thread. > > It appears to me that the only real reason that this doesn't work > might be because the the childs copy of the Mutex and cond variable are > not the same as the parents and parents thread. The thread is in a > pthread_cond_wait. > > Does the thread even know or care where or by whom the the cond > variable is satisfied. When the cond gets satisfied the thread should > wake up. How do I satisfy the cond from a child? > You have to set the mutex and condvar in a shared memory segment and use the process shared attribute assuming it's supported. Or use IPC semaphores or select() w/ a pipe fd or unix signals as mentioned before. There's a **REASON** you think you need to wait. There may be a real simple solution based on the mechanism associated with that reason. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .