Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #590
| From | Alexander Terekhov <terekhov@web.de> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: usage of vyukov's mpsc queue |
| Date | 2011-09-21 17:06 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <4E79FD7A.F4557F50@web.de> (permalink) |
| References | (2 earlier) <2011092106580817537-ephisinowitz@yahoocom> <4E79D246.E338E050@web.de> <39ca082e-34ad-43f5-8f6d-9944ae840875@l4g2000vbv.googlegroups.com> <4E79E431.59EFC897@web.de> <7f52d142-c0f4-4898-a498-2cf78fb4f97e@k15g2000yqd.googlegroups.com> |
Ephi Sinowitz wrote:
[...]
> Producers set event after the push(). Event only transitions from
> unset to set when producer is inside the while loop.
> Now when Consumer goes back to Wait he should see the set event. The
> only issue is that he may still see a NULL next pointer because there
> are no memory barriers in the push(). In that case the consumer will
> go back to wait and the event will stay unset forever. But the 30
> second time limit should take care of that.
> for(;;)
> WaitForSingleObject(m_queueEvent, 30000);
> while (void* item = vyukov_queue.pop())
> {
> // do work
> }
> }
With *timed* wait on <whatever> in consumer, push() and pop() need the
same barriers as without <whatever> blocking synchronization object.
Think of it as sleep(30) instead of WaitForSingleObject(m_queueEvent,
30000).
regards,
alexander.
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-20 06:55 -0700
Re: usage of vyukov's mpsc queue Joshua Maurice <joshuamaurice@gmail.com> - 2011-09-20 17:19 -0700
Re: usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-20 18:35 -0700
Re: usage of vyukov's mpsc queue Ephraim Sinowitz <ephisinowitz@yahoo.com> - 2011-09-21 06:42 -0400
Re: usage of vyukov's mpsc queue Joshua Maurice <joshuamaurice@gmail.com> - 2011-09-21 00:26 -0700
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 12:19 +0200
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 12:34 +0200
Re: usage of vyukov's mpsc queue Ephi Sinowitz <ephisinowitz@yahoo.com> - 2011-09-21 06:58 -0400
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 14:02 +0200
Re: usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-21 06:08 -0700
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 15:18 +0200
Re: usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-21 06:56 -0700
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 17:06 +0200
Re: usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-21 09:16 -0700
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 18:20 +0200
Re: usage of vyukov's mpsc queue Dmitriy Vyukov <dvyukov@gmail.com> - 2011-09-21 09:58 -0700
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-09-21 19:33 +0200
Re: usage of vyukov's mpsc queue dvyukov@google.com - 2011-10-02 04:13 -0700
Re: usage of vyukov's mpsc queue Alexander Terekhov <terekhov@web.de> - 2011-10-04 12:15 +0200
Re: usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-21 11:04 -0700
Re: usage of vyukov's mpsc queue Ephi Sinowitz <esinowitz.public@gmail.com> - 2011-09-21 11:17 -0700
Re: usage of vyukov's mpsc queue "Chris M. Thomasson" <cristom@charter.net> - 2011-09-24 22:44 -0700
csiph-web