Pthreads & Signals.
Jerry Feldman
gerald.feldman at hp.com
Thu Nov 18 11:34:14 EST 2004
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:
while (lock == 0) {
pthread_cond_wait()
lock = 1;
}
The use of lock here really does not accomplish anything useful in this
code. Certainly the child has a similar loop where is loops on lock == 1.
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.
--
Jerry Feldman <gerald.feldman at hp.com>
Partner Technology Access Center (contractor) (PTAC-MA)
Hewlett-Packard Co.
550 King Street LKG2a-X2
Littleton, Ma. 01460
(978)506-5243
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthrsignal_V2.c
Type: text/x-csrc
Size: 1437 bytes
Desc: not available
URL: <http://lists.blu.org/pipermail/discuss/attachments/20041118/24c8d83d/attachment.bin>
More information about the Discuss
mailing list