Very simple wrapper that provides thread-safe access to a basic queue of buffers.
More...
Public Member Functions |
| | DtThreadSafeBufferQueue (unsigned int initialBufferSize=1000, unsigned int initialBufferCount=10) |
| | Ctor.
|
| virtual | ~DtThreadSafeBufferQueue () |
| | Dtor.
|
| virtual void | push (const T *buff, unsigned int size) |
| | Push a copy of a T[] of size elements onto the back of the queue.
|
| virtual void | push (Buffer buff) |
| | Push a copy of a buffer onto the back of the queue.
|
| virtual std::auto_ptr< Buffer > | pop () |
| | Pop the next buffer from the front of the queue Popper assumes ownership of popped buffer.
|
| virtual void | releaseBuffer (std::auto_ptr< Buffer > buff) |
| | Return ownership of a buffer to the Queue for re-use.
|
| virtual size_t | size () const |
template<class T>
class DtThreadSafeBufferQueue< T >
Very simple wrapper that provides thread-safe access to a basic queue of buffers.
Queue always makes a complete copy of the pushed buffer. Each buffer element must be copyable. Ownership of popped buffers is assumed by the "popper". Popped buffers may be released to return ownership to the Queue for reuse.
- Warning
- Passing a buffer of pointers will break the Thread-Safety guarantee.
-
This class is definitely not an STL compliant template and it is
-
not 100% exception safe (lock may remain locked)