blob: c30d44f339957ec694a94886323faab59fdd77e4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef _THREADPOOL_H_
#define _THREADPOOL_H_
#include <dnbd3/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();
/**
* Block until all threads spawned have exited
*/
void threadpool_waitEmpty();
/**
* Run a thread using the thread pool.
* @param startRoutine function to run in new thread
* @param arg argument to pass to thead
* @param name STRING CONSTANT (literal) for debugging purposes
* @return true if thread was started
*/
bool threadpool_run(void *(*startRoutine)(void *), void *arg, const char *name);
#endif
|