GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
thpool.c File Reference
#include "ghost/config.h"
#include "ghost/thpool.h"
#include "ghost/util.h"
#include "ghost/machine.h"
Include dependency graph for thpool.c:

Functions

ghost_error ghost_thpool_create (int nThreads, void *(func)(void *))
 
ghost_error ghost_thpoolhread_add (void *(func)(void *), intptr_t arg)
 
ghost_error ghost_thpool_destroy ()
 Destroy the thread pool. More...
 
ghost_error ghost_thpool_get (ghost_thpool **thp)
 Get the thread pool. More...
 
ghost_error ghost_thpool_key (pthread_key_t *key)
 

Variables

static pthread_key_t ghost_thread_key = 0
 Each of the threads in the thread pool gets assigned the task it executes via pthread_setspecific. This is the key to this specific data. It is exported in ghost_taskq.h. More...
 
static ghost_thpoolthpool = NULL
 The thread pool created by ghost_thpool_create(). More...
 

Function Documentation

ghost_error ghost_thpool_create ( int  nThreads,
void *  func)(void * 
)

Here is the call graph for this function:

ghost_error ghost_thpool_destroy ( )

Destroy the thread pool.

Returns
GHOST_SUCCESS on success or an error indicator.

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.

Parameters
thpoolWhere to store the thread pool.
Returns
GHOST_SUCCESS on success or an error indicator.
ghost_error ghost_thpool_key ( pthread_key_t *  key)
ghost_error ghost_thpoolhread_add ( void *  func)(void *,
intptr_t  arg 
)

Variable Documentation

pthread_key_t ghost_thread_key = 0
static

Each of the threads in the thread pool gets assigned the task it executes via pthread_setspecific. This is the key to this specific data. It is exported in ghost_taskq.h.

ghost_thpool* thpool = NULL
static

The thread pool created by ghost_thpool_create().