From e01115702ad73c32efdf11b97d84a81f59300e1d Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Fri, 23 Dec 2016 02:01:39 +0100 Subject: common: thread-pool: initial work --- src/common/thread-pool.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/common/thread-pool.h (limited to 'src/common/thread-pool.h') diff --git a/src/common/thread-pool.h b/src/common/thread-pool.h new file mode 100644 index 0000000..4c14691 --- /dev/null +++ b/src/common/thread-pool.h @@ -0,0 +1,27 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2016 Rafael G. Martins + * + * This program can be distributed under the terms of the BSD License. + * See the file LICENSE. + */ + +#ifndef _THREAD_POOL_H +#define _THREAD_POOL_H + +#include "utils.h" + +typedef void (*bc_threadpool_func_t) (void *job, void *user_data); + +typedef struct { + bc_slist_t *jobs; + bc_slist_t *threads; + size_t max_threads; + bc_threadpool_func_t func; + void *user_data; +} bc_threadpool_t; + +bc_threadpool_t* bc_threadpool_new(bc_threadpool_func_t func, + size_t max_threads, void *user_data, bc_error_t **err); + +#endif /* _THREAD_POOL_H */ -- cgit v1.2.3-18-g5258