diff options
author | Simon Rettberg | 2015-01-05 14:17:49 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-01-05 14:17:49 +0100 |
commit | 84f93cf7b7768cbf522c75c4e3fe204cf6fd785c (patch) | |
tree | 6a186d58a4d00d4ec39daeb5c9acb08830f1889a /src/server/threadpool.h | |
parent | [SERVER] Dead code removal, minor performance tweaks, refactoring, etc. (diff) | |
download | dnbd3-84f93cf7b7768cbf522c75c4e3fe204cf6fd785c.tar.gz dnbd3-84f93cf7b7768cbf522c75c4e3fe204cf6fd785c.tar.xz dnbd3-84f93cf7b7768cbf522c75c4e3fe204cf6fd785c.zip |
[SERVER] Use a thread pool for client connections
Diffstat (limited to 'src/server/threadpool.h')
-rw-r--r-- | src/server/threadpool.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/server/threadpool.h b/src/server/threadpool.h new file mode 100644 index 0000000..b3b0fe6 --- /dev/null +++ b/src/server/threadpool.h @@ -0,0 +1,23 @@ +#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); + +/** + * 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 + |