descriptionThread pool library for unix/linux written in c
homepage URLhttp://launchpad.net/libctpool
ownerjames@jabsys.net
last changeSun, 31 Jan 2010 02:26:31 +0000 (31 02:26 +0000)
content tags
add:
README

Build
========

Release mode:

cmake .
make
make install

Debug mode:

cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-DDEBUG .
make
make install

api
======

Declare the pointer for the pools data, memory is malloc'd when you create the pool: 

thread_pool_t *pool_id;

Create the pool, returns 0 if the pool is created or POOL_CREATE_ERR otherwise.  Mode is either CTP_PRIORITY,
 CTP_FIFO (first in, first out) or FILO (first in, last out):

ctp_create_pool(&pool_id, min_threads, max_threads, mode);

Add a job to the pool, priority is 1 first, 99 last (ignored if mode is CTP_PRIORITY), *data must be a 
pointer to already malloc'd memory, returns 0 if the job is added, JOB_CREATE_ERR otherwise.  *data must be free'd before the function end:

ctp_add_job(pool_id, priority, *function, *data);

Kill the pool, destorys all jobs & threads, after already running jobs finish, returns 0 when the pool is killed:

ctp_kill_pool(&pool_id);

Pause/start the pool, already running jobs continue, no new jobs are started:

ctp_pause_pool(pool_id);
ctp_start_pool(pool_id);

Change max/min threads:

ctp_max_threads(pool_id, max_threads);
ctp_min_threads(pool_id, min_threads);

POOL_DEAD is returned by ctp_add_job, ctp_kill_pool, ctp_pause_pool, ctp_start_pool, ctp_max_threads &
 ctp_min_threads if a null pointer is passed to them

example.c contains sample code
shortlog
2010-01-31 James Burkeunit test for ctp_add_jobmaster
2010-01-28 James Burkelibctpool 0.2.0maint0.2.0
2010-01-27 James BurkeMerge branch 'maint'
2010-01-27 James Burkerenamed CMakeLists.txt for linux
2010-01-27 James Burkelibctpool 0.1.20.1.2
2010-01-27 James Burkepriority, fifo, filo scheduling
2010-01-27 James BurkeMerge branch 'maint'
2010-01-27 James Burkenull error0.1.1
2010-01-27 James Burkeincrease/decrease max & min threads
2010-01-27 James BurkeMerge branch 'maint'
2010-01-27 James Burkelibctpool 0.1.1
2010-01-27 James Burkeextra locks
2010-01-27 James Burkefixed spelling error
2010-01-26 James Burkelibctpool 0.1.00.1.0
2010-01-26 James Burkecheck for null pointers
2010-01-26 James Burkecleaned up example.c
...
tags
14 years ago 0.2.0 libctpool 0.2.0
14 years ago 0.1.2 libctpool 0.1.2
14 years ago 0.1.1 libctpool 0.1.1
14 years ago 0.1.0 libctpool 0.1.0
heads
14 years ago master
14 years ago maint