From fbee13e2f633f0db7c6c9ceeaf4c5d4867baa4f8 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 24 Aug 2021 16:43:29 -0700 Subject: 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. --- src/iou.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/iou.h') diff --git a/src/iou.h b/src/iou.h index 6609e81..77ddf97 100644 --- a/src/iou.h +++ b/src/iou.h @@ -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 -- cgit v1.2.3