Thread safe wrapper for queues derived from the CIQueue interface.
More...
#include <CCThreadedQueue.h>
Thread safe wrapper for queues derived from the CIQueue interface. This class will use a pointer to strongly aggregate a CIQueue object and wrap it's methods to make them threadsafe. To that effect, it requires an already constructed queue at construction time. Destroying the CCThreadedQueue object will result in the destruction of the aggregate CIQueue object.
char test = 'h'
char test_peek;
if( test_peek == 'h' ) {
printf("success!");
}
CDestroy(&queue);
- Attention
- Destroying a CCThreadQueue object will result in the destruction of the aggregate CIQueue object. See constructor, CCThreadedQueue(), for more details.
-
This class does not have any virtual methods. All class methods are not virtual.
- Class Constructor
- Parameters
-
| self | The instance of struct CCThreadedQueue to construct. |
| backbone | An instance of a CIQueue object. This will be used as the backbone for all queue operations. Note, when the destructor is called, this object will also be destroyed. |
- Returns
- CIQUEUE_OK on successful construction.
Reset the queue to having zero elements in it. All data copied into the queue is lost.
- Parameters
-
Insert an element into the tail of the queue by copy.
- Parameters
-
| self | The queue. |
| element | Pointer to data to copy into queue. |
| blockTime | Time in ms to wait for space in the queue. |
- Returns
- Error code.
Get the maximum number of elements allowed in the queue.
- Parameters
-
- Returns
- The maximum number of elements allowed in the queue.
Peek at the element in the head of the queue by copy. This does not remove the head.
- Parameters
-
| self | The queue. |
| element | Data in the head of the queue will be copied to the location pointed to by this. |
| blockTime | Time to wait in ms for data to be in the queue. |
- Returns
- An error code.
Remove an element from the head of the queue by copy.
- Parameters
-
| self | The queue |
| element | Data in the head of the queue will be copied into the location pointed to by this. Pass in NULL to remove the the head of the queue without copying out the data. |
| blockTime | Time in ms to wait for data to be in the queue. |
- Returns
- An error code.
The documentation for this struct was generated from the following file: