include/razorback/thread_pool.h File Reference

Thread worker pool API. More...

#include <razorback/visibility.h>
#include <razorback/types.h>
#include <razorback/api.h>
#include <razorback/list.h>
Include dependency graph for thread_pool.h:

Go to the source code of this file.

Data Structures

struct  ThreadPoolItem
 Thread pool item. More...
struct  ThreadPool
 Thread pool container. More...

Functions

SO_PUBLIC struct ThreadPoolThreadPool_Create (int initialThreads, int maxThreads, struct RazorbackContext *context, const char *namePattern, void(*mainFunction)(struct Thread *))
 Create a ThreadPool.
SO_PUBLIC bool ThreadPool_LaunchWorker (struct ThreadPool *pool)
 Launch a worker.
SO_PUBLIC bool ThreadPool_LaunchWorkers (struct ThreadPool *pool, int count)
 Launch several workers.
SO_PUBLIC bool ThreadPool_KillWorker (struct ThreadPool *pool, int id)
 Kill a worker.
SO_PUBLIC bool ThreadPool_KillWorkers (struct ThreadPool *pool)
 Kill all workers.

Detailed Description

Thread worker pool API.


Function Documentation

SO_PUBLIC struct ThreadPool* ThreadPool_Create ( int  initialThreads,
int  maxThreads,
struct RazorbackContext context,
const char *  namePattern,
void(*)(struct Thread *)  mainFunction 
) [read]

Create a ThreadPool.

Parameters:
intialThread The number of threads to launch on creation.
maxThreads The maximum number of workers allowed in the pool.
context The context of the worker threads.
namePattern The printf pattern for the worker thread names, must contain d
mainFunction The main routine for the threads.
Returns:
A new ThreadPool or NULL on error.
SO_PUBLIC bool ThreadPool_KillWorker ( struct ThreadPool pool,
int  id 
)

Kill a worker.

Parameters:
pool The ThreadPool to which the worker belongs.
id The workers id.
Returns:
true on success, false on error.
SO_PUBLIC bool ThreadPool_KillWorkers ( struct ThreadPool pool  ) 

Kill all workers.

Parameters:
pool The ThreadPool to kill the workers in.
Returns:
true on success, false on error
SO_PUBLIC bool ThreadPool_LaunchWorker ( struct ThreadPool pool  ) 

Launch a worker.

Parameters:
pool The ThreadPool to spawn a worker in.
Returns:
true on success, false on error.
SO_PUBLIC bool ThreadPool_LaunchWorkers ( struct ThreadPool pool,
int  count 
)

Launch several workers.

Parameters:
pool The ThreadPool to spawn the workers in.
count The number of workers to spawn.
Returns:
true on success, false on error.
 All Data Structures Files Functions Variables Enumerations Enumerator Defines
Generated on Sun Dec 9 04:00:11 2012 for RazorbackAPI by  doxygen 1.6.3