Pthreads & Signals.

Kevin D. Clark clark_k at pannaway.com
Thu Nov 18 12:39:27 EST 2004


Jerry Feldman <gerald.feldman at hp.com> writes:

> On Thursday 18 November 2004 9:05 am, you wrote:
>> Jerry Feldman <gerald.feldman at hp.com> writes:
>> > WRT: While loops. They accomplsh nothing.
>>
>> If this comment is directed towards my code or advice, please tell me
>> where you think I've gone wrong.
> I was responding more to Tony's post and his code:

[snip]

> But, removing the whiles, and just including the cond_wait works fine. I am 
> attaching my fixes to Tony's code, and you will see what I mean.

The reality is that if somebody raises a signal (an actual Unix
signal, not the things we have been discussing so far in this thread)
on the process that is running this code and pthread_cond_wait() is
interrupted, the program will act unpredictably.  I still contend that
nearly any call to pthread_cond_wait() that is not enclosed in a
proper loop is incorrect.

Regards,

--kevin
-- 
GnuPG ID: B280F24E                     And the madness of the crowd
                                       Is an epileptic fit
                                       -- Tom Waits



More information about the Discuss mailing list