![]() |
GHOST
1.1.2
General, Hybrid, and Optimized Sparse Toolkit
|
Types and functions for the thread pool. More...
Go to the source code of this file.
Classes | |
struct | ghost_thpool |
The thread pool consisting of all shepherd threads that will ever handle a GHOST task. More... | |
Typedefs | |
typedef struct ghost_thpool | ghost_thpool |
The thread pool consisting of all shepherd threads that will ever handle a GHOST task. More... | |
Functions | |
ghost_error | ghost_thpool_create (int nThreads, void *(*func)(void *)) |
Creates or resizes a thread pool. More... | |
ghost_error | ghost_thpool_destroy () |
Destroy the thread pool. More... | |
ghost_error | ghost_thpool_get (ghost_thpool **thpool) |
Get the thread pool. More... | |
ghost_error | ghost_thpool_key (pthread_key_t *key) |
ghost_error | ghost_thpoolhread_add (void *(func)(void *), intptr_t arg) |
Types and functions for the thread pool.
@{
typedef struct ghost_thpool ghost_thpool |
The thread pool consisting of all shepherd threads that will ever handle a GHOST task.
ghost_error ghost_thpool_create | ( | int | nThreads, |
void *(*)(void *) | func | ||
) |
Creates or resizes a thread pool.
nThreads | The number of threads in the thread pool. |
func | The start routine for each thread. |
In GHOST, the start routine works on a task queue. In a usual scenario one would like to have one shepherd thread for each processing unit. This assures that N tasks can run at the same time if each one occupies on processing unit. If this function is called a second, third etc. time, the size of the thread pool will be resized to the given nThreads.
ghost_error ghost_thpool_destroy | ( | ) |
Destroy the thread pool.
Before free'ing the resources, all pthreads in the thread pool are being joined (this is also where an error could occur).
ghost_error ghost_thpool_get | ( | ghost_thpool ** | thpool | ) |
Get the thread pool.
thpool | Where to store the thread pool. |
ghost_error ghost_thpool_key | ( | pthread_key_t * | key | ) |
ghost_error ghost_thpoolhread_add | ( | void * | func)(void *, |
intptr_t | arg | ||
) |