|
-
July 8th, 2005, 02:13 AM
#1
producer/Consumer
hi
i have a producer consumer programs running with sleep() command after every successful read/write.Now if the sleep command in the consumer is removed then the consumer is looping continuosly for the producer to produce.Instead shall v make it wait till the producer writes into shared memory so that consumer can read????wait() cant be used as there is no parent- child relationship exists between these programs ..so is there any other way?????
thanx in advance
Poorni
Life is like riding a bicycle To keep ur Balance u have to keep riding.
-
July 8th, 2005, 02:33 AM
#2
Re: producer/Consumer
OS? Linux: pthread_cond_signal and pthread_cond_wait
Win: WaitForMultipleObjects I believe...
-
July 8th, 2005, 05:12 AM
#3
-
July 8th, 2005, 10:31 AM
#4
Re: producer/Consumer
 Originally Posted by naddad
OS? Linux: pthread_cond_signal and pthread_cond_wait
Win: WaitForMultipleObjects I believe...
Or boost::condition on both platforms. (and many others)
Insert entertaining phrase here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|