summaryrefslogtreecommitdiff
path: root/src/main/async.h
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2025-07-10 21:24:03 -0400
committerCarson Fleming <cflems@cflems.net>2025-07-10 21:24:34 -0400
commita430aa79070b25e0863dfe8d729b27b5346199c6 (patch)
tree4887652a2ffb7c0eb8dd54e10ac45ce14568b4fb /src/main/async.h
parent52deba5ff9747af1b456edd4559dd63e27e1ae19 (diff)
downloadasyncc-a430aa79070b25e0863dfe8d729b27b5346199c6.tar.gz
Initial version
Diffstat (limited to 'src/main/async.h')
-rw-r--r--src/main/async.h18
1 files changed, 18 insertions, 0 deletions
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 <stdbool.h>
+
+#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