MPSolve 3.2.1
|
A thread pool that contains a set of mps_thread
and allow to manage them as a set of worker.
More...
#include <threading.h>
Public Attributes | |
unsigned int | n |
The numer of thread in the thread pool. | |
unsigned int | concurrency_limit |
Limit to the maximum spawnable number of threads. This can be set to 0 that means "No limit". It is useful when less concurrency is desired without deleting and recreating threads. More... | |
mps_thread * | first |
A pointer to the first thread in the thread pool. | |
mps_thread_pool_queue * | queue |
Queue of the work that shall be consumed by the threads. | |
pthread_mutex_t | queue_changed_mutex |
Mutex associated to the queue_changed condition. | |
pthread_cond_t | queue_changed |
Condition that is notified when the queue changes. | |
pthread_mutex_t | work_completed_mutex |
pthread_cond_t | work_completed_cond |
int | busy_counter |
mps_boolean | strict_async |
When this vaulue is set to true every call to mps_assign_job returns immediately. More... | |
A thread pool that contains a set of mps_thread
and allow to manage them as a set of worker.
unsigned int mps_thread_pool::concurrency_limit |
Limit to the maximum spawnable number of threads. This can be set to 0 that means "No limit". It is useful when less concurrency is desired without deleting and recreating threads.
This variables MUST be updated using the accessor function mps_thread_pool_set_
mps_boolean mps_thread_pool::strict_async |
When this vaulue is set to true every call to mps_assign_job returns immediately.
When it is set to false the calls to mps_thread_pool_assign() when the number of thread is set to 1 will immediately perform the work, instead of delegating it to a background thread. This is done to ensure reasonable performance for the cases where only 1 CPU is available on the PC.