Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pthreads & Signals.



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>



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org