This functionality is only available in the C++ toolkits. For other languages, we recommend using language-specific functionality instead.
template<class BUFFER> class OEProtectedBuffer
Thread-safe first-in-first-out (FIFO) queue that can have multiple
producers and consumers. Meant to wrap around either a
OEUnboundedBuffer object to provide thread-safe
access to those buffers. The OEBoundedBuffer
queue should be used to control memory consumption, as the
OEProtectedBuffer.Put operation will block,
allowing the queue to empty first. The
OEUnboundedBuffer queue will continue to
consume memory with every
OEProtectedBuffer(oesize_t maxsize) OEProtectedBuffer(oesize_t maxsize, oesize_t threshold)
Constructs a new
maxsize to the child
buffer implementation. The
threshold argument is a
performance tuning parameter that determines how often
called. Broadcasting to other queue users too often can have
negative performance implications as threads can be woken when
there is not enough work in the queue to fill up their time
quantum. Too infrequently means threads are left idle too long
before being awoken with new to perform. The default
threshold is half of
Return the next item from the queue in a thread-safe manner.
The value used to signal termination to the queue. Calling
OEProtectedBuffer.Put with the value
returned by the
Null method signals that the queue is ‘done’
and should not accept anymore data. Subsequent
OEProtectedBuffer.Put operations will fail
continue to return data until the queue is empty, and then start
returning the result of the
Null method as well. Note, this
method returns the default constructed value for the
value_type being stored in the queue, this is typically
NULL for integral or pointer types respectively.
Returns the item that will be returned by the next call to
OEProtectedBuffer.Get, but does not remove
it from the buffer.
bool Put(value_type obj)
Place an item into the queue in a thread-safe manner.