aboutsummaryrefslogtreecommitdiff
path: root/include/bh/thread.h
diff options
context:
space:
mode:
authorMikhail Romanko <me@blankhex.com>2024-04-23 23:45:43 +0300
committerMikhail Romanko <me@blankhex.com>2024-04-23 23:45:43 +0300
commit692b5b42974e2f81dc4ad708a4593b1e8cb2bd3d (patch)
treeb7eec97f4a12e0090b9421e7dfe8a6116b7ef4d8 /include/bh/thread.h
parentec499b6cfc3fe196757d4467ca044b5915198d45 (diff)
downloadbhlib-old-692b5b42974e2f81dc4ad708a4593b1e8cb2bd3d.tar.gz
Sync to the latest version.
Can be broken or partially implemented.
Diffstat (limited to 'include/bh/thread.h')
-rw-r--r--include/bh/thread.h56
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.
*