Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #345
| From | "Balog Pal" <pasa@lib.hu> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: Fastest way to extract data from producer-consumer shared queue |
| Date | 2011-06-21 16:53 +0200 |
| Organization | ETT newsserver |
| Message-ID | <itqbaa$1551$1@news.ett.com.ua> (permalink) |
| References | <9a94c240-89e1-4382-81b8-427a60b04039@v11g2000prk.googlegroups.com> |
"ittium" <ittium@gmail.com> > I am worried about extract element procedure. If I copy the elements > from queue to some other data structure (another queue or vector) then > this copy might become bottle neck. Why copy? Use list<unique_ptr<T>> for your queue. Or something equivalent. > if I extract one element each time then mutex contention between > producer and consumer can become bottleneck. You said processing is the low thing. that means mutex operations will hardly be a problem. But the other tech I used was to just swap() the queue with an empty local one. Works fine with simple list<T> and similar queues.
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Fastest way to extract data from producer-consumer shared queue ittium <ittium@gmail.com> - 2011-06-21 03:13 -0700
Re: Fastest way to extract data from producer-consumer shared queue "Balog Pal" <pasa@lib.hu> - 2011-06-21 16:53 +0200
Re: Fastest way to extract data from producer-consumer shared queue ittium <ittium@gmail.com> - 2011-06-23 06:19 -0700
Re: Fastest way to extract data from producer-consumer shared queue "Balog Pal" <pasa@lib.hu> - 2011-06-23 17:08 +0200
csiph-web