diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2021-08-24 16:43:29 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2021-08-24 16:49:49 -0700 |
commit | fbee13e2f633f0db7c6c9ceeaf4c5d4867baa4f8 (patch) | |
tree | 3648bafe4705bf93af1c18e32ed4c655d03d2c03 /src/iou.h | |
parent | 6ffa68421a2804c957ca5661e97b35541378ac72 (diff) |
iou: introduce iou_async() for threading
This is a preliminary implementaion of an iou-abstracted thread
pool.
Two callbacks are provided to iou_async():
async_cb:
Called by a worker thread and must be carefully written for
concurrent execution.
completion_cb:
Called by iou_run() after a thread has finished with async_cb().
As completion_cb() is called in the iou_run() context, assuming
the caller is always entering iou_run() from the main thread,
it may be viewed as a continuation point for the async work
reentering the serial execution flow.
At this time every iou_new() will create two worker threads. In
the future it may just create a thread per core or something like
that.
Diffstat (limited to 'src/iou.h')
-rw-r--r-- | src/iou.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -36,5 +36,6 @@ int iou_run(iou_t *iou); int iou_quit(iou_t *iou); int iou_resize(iou_t *iou, unsigned entries); struct io_uring * iou_ring(iou_t *iou); +int iou_async(iou_t *iou, int (*async_cb)(void *async_cb_data), void *async_cb_data, int (*completion_cb)(void *completion_cb_data), void *completion_cb_data); #endif |