29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
* @brief A class providing a pool of reusable threads.
*
* @note When the thread pool is released, all threads will terminate after
* they finish the job they are currently processing.
*/
@interface OFThreadPool: OFObject
{
size_t size;
OFMutableArray *threads;
volatile int count;
@public
OFList *queue;
OFCondition *queueCondition;
volatile int doneCount;
OFCondition *countCondition;
}
/*!
* @brief Returns a new thread pool with one thread for each core in the system.
*
* @warning If for some reason the number of cores in the system could not be
* determined, the pool will only have one thread!
|
|
|
|
|
|
|
|
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
* @brief A class providing a pool of reusable threads.
*
* @note When the thread pool is released, all threads will terminate after
* they finish the job they are currently processing.
*/
@interface OFThreadPool: OFObject
{
size_t _size;
OFMutableArray *_threads;
volatile int _count;
@public
OFList *_queue;
OFCondition *_queueCondition;
volatile int _doneCount;
OFCondition *_countCondition;
}
/*!
* @brief Returns a new thread pool with one thread for each core in the system.
*
* @warning If for some reason the number of cores in the system could not be
* determined, the pool will only have one thread!
|