|
Reduct
v4.0.5-1-g4851deb
A functional and immutable language.
|
Task primitives. More...
#include <reduct/defs.h>#include <reduct/error.h>#include <reduct/sync.h>#include <stdatomic.h>#include <stdbool.h>#include <stdint.h>#include <threads.h>Go to the source code of this file.
Data Structures | |
| struct | reduct_task_id_t |
| Task ID structure. More... | |
| struct | reduct_task_t |
| Task structure. More... | |
| struct | reduct_task_global_t |
| Global thread-related state structure. More... | |
Macros | |
| #define | REDUCT_TASK_QUEUE_MAX 256 |
| The maximum number of tasks. | |
| #define | REDUCT_TASK_SPIN_MAX 1000 |
| The maximum number of times to spin while waiting for work to be ready. | |
| #define | REDUCT_TASK_ID_INVALID ((reduct_task_id_t){ .index = UINT16_MAX, .generation = UINT16_MAX }) |
| Invalid task ID. | |
Functions | |
| REDUCT_API int | reduct_task_worker (void *arg) |
| Worker thread main loop.. | |
| REDUCT_API void | reduct_task_global_init (reduct_task_global_t *global) |
| Initialize a global task state. | |
| REDUCT_API void | reduct_task_global_deinit (reduct_task_global_t *global) |
| Deinitialize a global task state. | |
| REDUCT_API bool | reduct_task_create (struct reduct *reduct, void(*func)(struct reduct *reduct, void *arg), void *arg, reduct_task_id_t *outId) |
| Try to create a new task. | |
| REDUCT_API void | reduct_task_join (struct reduct *reduct, reduct_task_id_t id) |
| Wait for a task to finish. | |
| static REDUCT_ALWAYS_INLINE uint64_t | reduct_task_queue_size (reduct_task_global_t *global) |
| Retrieve the number of pending tasks. | |
| REDUCT_API void | reduct_task_barrier (struct reduct *reduct) |
| Barrier function to ensure all threads have either reached the barrier. | |
Task primitives.
Definition in file task.h.