#include <blockingqueue_decls.h>
Public Member Functions | |
BlockingQueue () | |
BlockingQueue constructor. | |
bool | isempty () const |
| |
void | put (const C &item) |
Puts the given item in the queue. | |
C | get () |
Gets an item from the queue. |
Items can be put using .put(item) which is nonblocking. They can be taken out with blockingly with .get() if the queue is empty (when .isempty() returns true). It will return when another thread .put()s an item.
void BlockingQueue< C >::put | ( | const C & | item | ) | [inline] |
Puts the given item in the queue.
This will use the item's copy operator at least once. The operation is nonblocking.
item | is the item to be put. |
C BlockingQueue< C >::get | ( | ) | [inline] |
Gets an item from the queue.
If the queue is empty, this operation will block the current thread until another thread put()s an item in the queue. If another thread also waits to get() something one of them will get the object being put(). Which one of the waiting thread actually gets the object is unspecified.