Sync to the latest version.

Can be broken or partially implemented.
This commit is contained in:
2024-04-23 23:45:43 +03:00
parent ec499b6cfc
commit 692b5b4297
26 changed files with 785 additions and 60 deletions

View File

@@ -42,6 +42,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
*
@@ -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.
*