CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Location
    India
    Posts
    276

    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.

  2. #2
    Join Date
    Apr 2005
    Posts
    62

    Re: producer/Consumer

    OS? Linux: pthread_cond_signal and pthread_cond_wait
    Win: WaitForMultipleObjects I believe...

  3. #3
    Join Date
    Apr 2005
    Location
    Mumbai,India
    Posts
    185

  4. #4
    Join Date
    May 2004
    Location
    Norway
    Posts
    655

    Re: producer/Consumer

    Quote 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
  •  





Click Here to Expand Forum to Full Width

Featured