From a430aa79070b25e0863dfe8d729b27b5346199c6 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 10 Jul 2025 21:24:03 -0400 Subject: Initial version --- src/main/async.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/async.h (limited to 'src/main/async.h') diff --git a/src/main/async.h b/src/main/async.h new file mode 100644 index 0000000..b21c594 --- /dev/null +++ b/src/main/async.h @@ -0,0 +1,18 @@ +#ifndef ASYNC_H +#define ASYNC_H 1 +#include + +#define ASYNC_NO_THUNK 0 + +struct async_pool; +typedef struct async_pool async_pool_t; +typedef void*(*async_thunk_t)(void*); +typedef unsigned int async_thunk_id_t; + +async_pool_t* async_pool_create(int n_threads); +async_thunk_id_t async_submit(async_pool_t* pool, async_thunk_t thunk, void* args, bool awaitable); +void* async_await(async_pool_t* pool, async_thunk_id_t thunk_id); +void async_pool_join(async_pool_t* pool); +void async_pool_destroy(async_pool_t* pool); + +#endif -- cgit v1.2.3