#include <stdlib.h>
#include <stddef.h>
#include <pthread.h>
Go to the source code of this file.
◆ bq_create()
Create a bounded queue with a fixed capacity.
- Parameters
-
| capacity | The maximum number of elements the queue can hold. |
- Returns
- Pointer to a bounded_queue_t, NULL on bad-capacity or alloc failure.
◆ bq_destroy()
Destroy the bounded queue and free resources.
- Parameters
-
| q | The bounded queue to destroy. |
◆ bq_pop()
Pop an entry from the queue. Handles not_empty signal, blocks if empty.
- Parameters
-
- Returns
- Pointer to the popped item.
◆ bq_push()
Add an entry to the queue. Handles not_full, blocks while full.
- Parameters
-
| q | The bounded queue. |
| item | The item to be added. |
- Returns
- 0 on success, -1 if shutdown is called while waiting on not_full.
◆ bq_shutdown()
Handle clean shutdown when working queue is done. Responsible for handling all waiting workers on dead signals and setting the shutdown flag.
- Parameters
-