diff options
Diffstat (limited to 'include/bh/thread.h')
| -rw-r--r-- | include/bh/thread.h | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/include/bh/thread.h b/include/bh/thread.h index 21edc1c..45a0e6e 100644 --- a/include/bh/thread.h +++ b/include/bh/thread.h @@ -43,6 +43,50 @@ bh_thread_pool_t *bh_thread_pool_new_base(size_t size, #endif /** + * @brief Create new task + * + * @param func Function + * @param data Function data + * @param flags Task flags + * + * @return Pointer to the new task + * + * @sa bh_task_free, bh_task_reuse, bh_task_done + */ +bh_task_t *bh_task_new(void (*func)(void *), + void *data, + int flags); + +/** + * @brief Free the task. + * + * @param task Pointer to the task + */ +void bh_task_free(bh_task_t *task); + +/** + * @brief Reuse task. + * + * @param task Pointer to the task + * @param func Function + * @param data Data + * + * @sa bh_task_free, bh_task_done + */ +void bh_task_reuse(bh_task_t *task, + void (*func)(void *), + void *data); + +/** + * @brief Check if task is done. + * + * @param task Pointer to the task + * + * @return The return value is boolean flag, indicating if the task is done. + */ +int bh_task_done(bh_task_t *task); + +/** * @function bh_thread_new * * @brief Create new thread. @@ -205,18 +249,6 @@ int bh_cond_signal(bh_cond_t *cond); */ int bh_cond_broadcast(bh_cond_t *cond); -bh_task_t *bh_task_new(void (*func)(void *), - void *data, - int flags); - -void bh_task_free(bh_task_t *task); - -void bh_task_reuse(bh_task_t *task, - void (*func)(void *), - void *data); - -int bh_task_done(bh_task_t *task); - /** * @brief Submit task to the thread pool. * |
