pthread_pool.h File Reference

functions that provide a pool of threads to pass work to More...

#include <pthread.h>
#include <sched.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  pool_data_t
 pthread_pool_t data structure More...
struct  pthread_poolattr_t
 pthread_pool_t attribute structure More...
struct  pthread_pool_t
 pthread_pool_t structure More...

Defines

#define PTHREAD_POOL_NONBLOCKING   PTHREAD_POOL_NONBLOCKING
 pthread_pool_t non-blocking enumeration
#define PTHREAD_POOL_BLOCKING   PTHREAD_POOL_BLOCKING
 pthread_pool_t blocking enumeration

Enumerations

enum  { PTHREAD_POOL_NONBLOCKING, PTHREAD_POOL_BLOCKING }
 pthread_pool_t blocking attribute enumeration More...

Functions

int pthread_pool_init (pthread_pool_t *pool, const pthread_poolattr_t *attr, const int num_threads, const int max_queue_length)
 initialize pthread_pool_t structure
int pthread_pool_destroy (pthread_pool_t *pool)
 destroy pthread_pool_t structure
int pthread_pool_addwork (pthread_pool_t *pool, void(*routine)(void *), void *arg)
 add routine(arg) to pool work to be done
int pthread_pool_getindex (pthread_pool_t *pool, int *pool_index)
 set index to thread pool index (starting at zero)
int pthread_pool_finishwork (pthread_pool_t *pool)
 suspend calling thread until all pool work is done
int pthread_poolattr_init (pthread_poolattr_t *attr)
 initialize pthread_pool_t attribute structure
int pthread_poolattr_destroy (pthread_poolattr_t *attr)
 destroy pthread_pool_t attribute structure
int pthread_poolattr_getblock (const pthread_poolattr_t *attr, int *block)
 set block to current blocking value
int pthread_poolattr_setblock (pthread_poolattr_t *attr, const int block)
 set current blocking value to block


Detailed Description

functions that provide a pool of threads to pass work to

Warning:


Enumeration Type Documentation

anonymous enum

pthread_pool_t blocking attribute enumeration

Enumerator:
PTHREAD_POOL_NONBLOCKING  pthread_pool_t non-blocking enumeration
PTHREAD_POOL_BLOCKING  pthread_pool_t blocking enumeration


Function Documentation

int pthread_pool_addwork ( pthread_pool_t pool,
void(*)(void *)  routine,
void *  arg 
)

add routine(arg) to pool work to be done

Parameters:
pool pointer to pthread_pool_t structure
routine pointer to a function
arg pointer to argument for routine
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_pool_destroy ( pthread_pool_t pool  ) 

destroy pthread_pool_t structure

Parameters:
pool pointer to pthread_pool_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_pool_finishwork ( pthread_pool_t pool  ) 

suspend calling thread until all pool work is done

Parameters:
pool pointer to pthread_pool_t structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_pool_getindex ( pthread_pool_t pool,
int *  pool_index 
)

set index to thread pool index (starting at zero)

Parameters:
pool pointer to pthread_pool_t structure
pool_index pointer to an index
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_pool_init ( pthread_pool_t pool,
const pthread_poolattr_t attr,
const int  num_threads,
const int  max_queue_length 
)

initialize pthread_pool_t structure

Parameters:
pool pointer to pthread_pool_t structure
attr pointer to pthread_pool_t attribute structure
num_threads number of threads
max_queue_length maximum queue length
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_poolattr_destroy ( pthread_poolattr_t attr  ) 

destroy pthread_pool_t attribute structure

Parameters:
attr pointer to pthread_pool_t attribute structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_poolattr_getblock ( const pthread_poolattr_t attr,
int *  block 
)

set block to current blocking value

Parameters:
attr pointer to pthread_pool_t attribute structure
block pointer to blocking value
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_poolattr_init ( pthread_poolattr_t attr  ) 

initialize pthread_pool_t attribute structure

Parameters:
attr pointer to pthread_pool_t attribute structure
Returns:
0 is returned on success
non-zero error code is returned on failure

int pthread_poolattr_setblock ( pthread_poolattr_t attr,
const int  block 
)

set current blocking value to block

Parameters:
attr pointer to pthread_pool_t attribute structure
block blocking value
Returns:
0 is returned on success
non-zero error code is returned on failure


Generated on Tue Apr 24 20:01:36 2007 for libctf by  doxygen 1.5.1