diff options
author | Frederic Robra | 2019-06-25 17:03:28 +0200 |
---|---|---|
committer | Frederic Robra | 2019-06-25 17:03:28 +0200 |
commit | 43e57ce5e11e9052f5a7db66f2e8613f1784f919 (patch) | |
tree | c5e1372a160b2601f61b18d617b71799b06b02ae /src/server/threadpool.h | |
download | dnbd3-ng-43e57ce5e11e9052f5a7db66f2e8613f1784f919.tar.gz dnbd3-ng-43e57ce5e11e9052f5a7db66f2e8613f1784f919.tar.xz dnbd3-ng-43e57ce5e11e9052f5a7db66f2e8613f1784f919.zip |
first version of dnbd3-ng
Diffstat (limited to 'src/server/threadpool.h')
-rw-r--r-- | src/server/threadpool.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/server/threadpool.h b/src/server/threadpool.h new file mode 100644 index 0000000..15dd151 --- /dev/null +++ b/src/server/threadpool.h @@ -0,0 +1,29 @@ +#ifndef _THREADPOOL_H_ +#define _THREADPOOL_H_ + +#include "../types.h" + +/** + * Initialize the thread pool. This must be called before using + * threadpool_run, and must only be called once. + * @param maxIdleThreadCount maximum number of idle threads in the pool + * @return true if initialized successfully + */ +bool threadpool_init(int maxIdleThreadCount); + +/** + * Shut down threadpool. + * Only call if it has been initialized before. + */ +void threadpool_close(); + +/** + * Run a thread using the thread pool. + * @param startRoutine function to run in new thread + * @param arg argument to pass to thead + * @return true if thread was started + */ +bool threadpool_run(void *(*startRoutine)(void *), void *arg); + +#endif + |