Provides a multiple-producer, multiple-consumer queue.
More...
Go to the source code of this file.
|
|
typedef struct qev_queue | qev_queue_t |
| | Yeah, I'm going to need you to go ahead and not touch this.
|
| |
Provides a multiple-producer, multiple-consumer queue.
- Author
- Andrew Stone andre.nosp@m.w@cl.nosp@m.ovar..nosp@m.com
- Copyright
- 2012-2014 Clear Channel Inc.
Removes the next available thing from the queue.
- Parameters
-
| q | The queue to get an item from |
- Returns
- An item from the queue, or NULL if the queue is empty.
Removes the next available thing from the queue in a non-thread-safe manner.
- Note
- This function SHOULD ONLY be used in cooperation with qev_queue_enqueue_unlocked from a single thread. If you choose to use it with the locked functions, be sure that nothing else is touching the queue before calling this.
- Parameters
-
| q | The queue to get an item from |
- Returns
- An item from the queue, or NULL if the queue is empty.
| gboolean qev_queue_enqueue |
( |
qev_queue_t * |
q, |
|
|
void * |
thing |
|
) |
| |
Adds thing to the queue.
- Parameters
-
| q | The queue to insert into. |
| thing | The thing to add. |
- Returns
- If the item was inserted; this will only fail if the queue is full
| gboolean qev_queue_enqueue_unlocked |
( |
qev_queue_t * |
q, |
|
|
void * |
thing |
|
) |
| |
Adds thing to the queue in a non-thread-safe manner.
- Note
- This function SHOULD ONLY be used in cooperation with qev_queue_dequeue_unlocked from a single thread. If you choose to use it with the locked functions, be sure that nothing else is touching the queue before calling this.
- Parameters
-
| q | The queue to insert into. |
| thing | The thing to add. |
- Returns
- If the item was inserted; this will only fail if the queue is full
Frees up the queue.
- Attention
- If the queue is not empty, you're going to leak memory.
- Parameters
-
Creates a new queue.
- Parameters
-
| size | The maximum size of the queue. MUST be a power of 2. |
The number of items in the queue.
- Parameters
-
| q | The queue to get the size of |
- Returns
- The size of the queue