#include <Utilities/Threads/interface/TSqueue.h>
Public Types | |
typedef TSqueue< X > | self |
Public Member Functions | |
void | abort () |
abort (called by a consumer to inform producer) | |
void | clear () |
void | drain () |
drain queue (wait for) (run in producer) | |
X | pop () |
(run in consumer) | |
void | push (const X &x) |
(run in producer) | |
void | reset () |
size_t | size () const |
void | terminate () |
terminate (called by producer to inform consumer) | |
TSqueue (size_t imax=1000, size_t imin=900) | |
Private Attributes | |
bool | abort_ |
std::queue< X, std::deque< X > > | cont |
boost::condition | dodrain |
bool | draining_ |
SimpleLockMutex::Mutex | genLock |
size_t | maxSize |
size_t | minSize |
boost::condition | notEmpty |
boost::condition | notFull |
bool | terminate_ |
Definition at line 24 of file TSqueue.h.
abort (called by a consumer to inform producer)
Definition at line 76 of file TSqueue.h.
Referenced by TSqueueConsumer< X, C >::abort().
00076 { 00077 SimpleLockMutex gl(genLock); 00078 abort_ = true; 00079 clear(); 00080 notFull.notify_all(); 00081 if (draining_) dodrain.notify_all(); 00082 }
drain queue (wait for) (run in producer)
Definition at line 85 of file TSqueue.h.
Referenced by TSqueueConsumer< X, C >::wait().
00085 { 00086 SimpleLockMutex gl(genLock); 00087 if (cont.empty()) return; 00088 draining_=true; 00089 notEmpty.notify_all(); 00090 while(!cont.empty()) { 00091 dodrain.wait(gl()); 00092 if (abort_) throw TSqueue_termination(); 00093 } 00094 }
(run in consumer)
Definition at line 55 of file TSqueue.h.
Referenced by VisQueueProcessor::process(), and TSqueueConsumer< X, C >::run().
00055 { 00056 SimpleLockMutex gl(genLock); 00057 while(cont.empty()) { 00058 if (draining_) dodrain.notify_all(); 00059 if (terminate_) throw TSqueue_termination(); 00060 notEmpty.wait(gl()); 00061 } 00062 X x = cont.front(); 00063 cont.pop(); 00064 if (cont.size()<minSize) notFull.notify_all(); 00065 return x; 00066 }
(run in producer)
Definition at line 43 of file TSqueue.h.
Referenced by TSqueueConsumer< X, C >::push().
00043 { 00044 SimpleLockMutex gl(genLock); 00045 if (abort_) throw TSqueue_termination(); 00046 while(cont.size()>maxSize) { 00047 notFull.wait(gl()); 00048 if (abort_) throw TSqueue_termination(); 00049 } 00050 cont.push(x); 00051 if ( !(cont.size()<minSize )) { notEmpty.notify_all(); } 00052 }
Definition at line 38 of file TSqueue.h.
Referenced by TSqueueConsumer< X, C >::reset().
00038 { 00039 draining_=terminate_=abort_=false; 00040 }
Definition at line 96 of file TSqueue.h.
Referenced by TSqueueConsumer< X, C >::run(), and TSqueueConsumer< X, C >::size().
00096 { 00097 SimpleLockMutex gl(genLock); 00098 return cont.size(); 00099 }
terminate (called by producer to inform consumer)
Definition at line 69 of file TSqueue.h.
Referenced by TSqueueConsumer< X, C >::~TSqueueConsumer().
00069 { 00070 SimpleLockMutex gl(genLock); 00071 terminate_ = true; 00072 notEmpty.notify_all(); 00073 }
Definition at line 124 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::abort(), TSqueue< lat::Callback >::drain(), TSqueue< lat::Callback >::push(), and TSqueue< lat::Callback >::reset().
Definition at line 110 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::clear(), TSqueue< lat::Callback >::drain(), TSqueue< lat::Callback >::pop(), TSqueue< lat::Callback >::push(), and TSqueue< lat::Callback >::size().
Definition at line 118 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::abort(), TSqueue< lat::Callback >::drain(), and TSqueue< lat::Callback >::pop().
Definition at line 121 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::abort(), TSqueue< lat::Callback >::drain(), TSqueue< lat::Callback >::pop(), and TSqueue< lat::Callback >::reset().
SimpleLockMutex::Mutex TSqueue< X >::genLock [mutable, private] |
Definition at line 115 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::abort(), TSqueue< lat::Callback >::drain(), TSqueue< lat::Callback >::pop(), TSqueue< lat::Callback >::push(), TSqueue< lat::Callback >::size(), and TSqueue< lat::Callback >::terminate().
Definition at line 113 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::pop(), TSqueue< lat::Callback >::push(), and TSqueue< lat::Callback >::TSqueue().
Definition at line 116 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::drain(), TSqueue< lat::Callback >::pop(), TSqueue< lat::Callback >::push(), and TSqueue< lat::Callback >::terminate().
Definition at line 117 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::abort(), TSqueue< lat::Callback >::pop(), and TSqueue< lat::Callback >::push().
bool TSqueue< X >::terminate_ [private] |
Definition at line 123 of file TSqueue.h.
Referenced by TSqueue< lat::Callback >::pop(), TSqueue< lat::Callback >::reset(), and TSqueue< lat::Callback >::terminate().