summaryrefslogtreecommitdiff
path: root/thread_pool.h
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2022-12-25 13:50:41 +0100
committerMikhail Burakov <mburakov@mailbox.org>2022-12-25 13:50:41 +0100
commitd58fcf64d9e7a3f309a706ce6a81eb9a41eb5348 (patch)
tree56ce15a6d0a006d8c8d5e01144216d8d2d46e5f0 /thread_pool.h
parent3f1e645ee1410d90b493b2e0034e25d68bd0d3eb (diff)
Cosmetic rework of toolbox
Diffstat (limited to 'thread_pool.h')
-rw-r--r--thread_pool.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/thread_pool.h b/thread_pool.h
index 496fd9c..9954846 100644
--- a/thread_pool.h
+++ b/thread_pool.h
@@ -15,14 +15,15 @@
* along with toolbox. If not, see <https://www.gnu.org/licenses/>.
*/
-#ifndef THREAD_POOL_H_
-#define THREAD_POOL_H_
+#ifndef TOOLBOX_THREAD_POOL_H_
+#define TOOLBOX_THREAD_POOL_H_
#include <stdatomic.h>
+#include <stdbool.h>
#include <stddef.h>
#include <threads.h>
-struct ThreadPool_Task;
+struct ThreadPoolTask;
struct ThreadPool {
atomic_bool running;
@@ -30,13 +31,13 @@ struct ThreadPool {
size_t threads_count;
cnd_t tasks_cond;
mtx_t tasks_mutex;
- struct ThreadPool_Task* tasks;
+ struct ThreadPoolTask* tasks;
size_t tasks_count;
};
-int ThreadPool_Create(struct ThreadPool* thread_pool, size_t threads_count);
-int ThreadPool_Schedule(struct ThreadPool* thread_pool, void (*fun)(void*),
+bool ThreadPoolCreate(struct ThreadPool* thread_pool, size_t threads_count);
+bool ThreadPoolSchedule(struct ThreadPool* thread_pool, void (*fun)(void*),
void* user);
-void ThreadPool_Destroy(struct ThreadPool* thread_pool);
+void ThreadPoolDestroy(struct ThreadPool* thread_pool);
-#endif // THREAD_POOL_H_
+#endif // TOOLBOX_THREAD_POOL_H_