![]() |
MAOS
Multithreaded Adaptive Optics Simulator
|
Data Structures | |
| struct | tp_counter_t |
Macros | |
| #define | ENABLE_TP_TIMING 0 |
| define to 1 to enable report of timing for each thread launch. Reduce number of threads when timing is small. | |
Functions | |
| struct tp_counter_t | __attribute__ ((unused)) |
| void | thread_pool_init (unsigned int nthread) |
| void | thread_pool_queue (tp_counter_t *counter, thread_wrapfun fun, void *arg, int njob, int urgent) |
| void | thread_pool_wait (tp_counter_t *counter, int urgent) |
| void | thread_pool_wait_all (void) |
| void | thread_pool_destroy (void) |
Contains implementation of a thread pool.
| void thread_pool_init | ( | unsigned int | nthread | ) |
Initialize the thread pool. Repeated call to resize the pool
| void thread_pool_queue | ( | tp_counter_t * | counter, |
| thread_wrapfun | fun, | ||
| void * | arg, | ||
| int | njob, | ||
| int | urgent ) |
Queue jobs that belongs to group denoted by group. The argument group, will be incremented by 1 for each job queued and decreased by 1 after each job is finished. Wait on it will clear when count is decreased to zero.
Job is added to jobsnormal or joburgent depending on urgent value
| void thread_pool_wait | ( | tp_counter_t * | counter, |
| int | urgent ) |
Wait for jobs in the count to be done. Has the potential to deadlock if it calls do_job and the job inside calls pthread_cond_wait.
| void thread_pool_wait_all | ( | void | ) |
Wait for all jobs to be done.
| void thread_pool_destroy | ( | void | ) |
Exit all threads and free thread pool.