Coin3D is Free Software, published under the BSD 3-clause license. |
https://bitbucket.org/Coin3D/ http://www.kongsberg.com/kogt/ |
Go to the source code of this file.
Typedefs | |
typedef void | cc_wpool_f(void *) |
Functions | |
cc_wpool * | cc_wpool_construct (int numworkers) |
void | cc_wpool_destruct (cc_wpool *pool) |
int | cc_wpool_get_num_workers (cc_wpool *pool) |
void | cc_wpool_set_num_workers (cc_wpool *pool, int newnum) |
void | cc_wpool_wait_all (cc_wpool *pool) |
SbBool | cc_wpool_try_begin (cc_wpool *pool, int numworkersneeded) |
void | cc_wpool_begin (cc_wpool *pool, int numworkersneeded) |
void | cc_wpool_start_worker (cc_wpool *pool, cc_wpool_f *workfunc, void *closure) |
void | cc_wpool_end (cc_wpool *pool) |
void cc_wpool_destruct | ( | cc_wpool * | pool | ) |
Destruct worker pool. Will wait for all jobs in progress to finish
Sets the number of workers in the pool.
void cc_wpool_wait_all | ( | cc_wpool * | pool | ) |
Wait for all pool workers to finish working and go into idle state. This method should only be called by the thread controlling the pool. A pool worker should not call this method, since it will obviously never return from here (it will never go idle).
Locks the pool so that workers can be started using the cc_wpool_start_worker() method. numworkersneeded should contain the minumum number of workers that is needed. If numworkersneeded workers are available, the pool will be locked and TRUE is returned. Otherwise FALSE is returned.
Usage pseudocode:
Important! If too few workers are available, the pool will not be locked and cc_wpool_end() should not be called.
Wait for numworkersneeded workers to become idle. When returning from this call, the pool will be locked, and up to numworkersneeded can be started using the cc_wpool_start_worker() method. Remember to call cc_wpool_end() to unlock the pool again.
void cc_wpool_start_worker | ( | cc_wpool * | pool, |
cc_wpool_f * | workfunc, | ||
void * | closure | ||
) |
Starts a worker. The pool must be locked (using cc_wpool_begin()) before calling this method.
void cc_wpool_end | ( | cc_wpool * | pool | ) |
Unlocks the pool after a cc_wpool_begin(), cc_wpool_start_worker() sequence.
Please note that if cc_wpool_begin() returns 0, you should not call cc_wpool_end().