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_sched_f(void *closure) |
Functions | |
cc_sched * | cc_sched_construct (int numthreads) |
void | cc_sched_destruct (cc_sched *sched) |
void | cc_sched_set_num_threads (cc_sched *sched, int num) |
int | cc_sched_get_num_threads (cc_sched *sched) |
uint32_t | cc_sched_schedule (cc_sched *sched, cc_sched_f *workfunc, void *closure, float priority) |
SbBool | cc_sched_unschedule (cc_sched *sched, uint32_t schedid) |
void | cc_sched_wait_all (cc_sched *sched) |
int | cc_sched_get_num_remaining (cc_sched *sched) |
void | cc_sched_set_num_allowed (cc_sched *sched, int num) |
void | cc_sched_change_priority (cc_sched *sched, uint32_t schedid, float priority) |
void cc_sched_f |
The type definition for the work function called when a thread becomes available.
void cc_sched_destruct | ( | cc_sched * | sched | ) |
Destruct the scheduler.
This method will block until all currently executing jobs have finished. Any remaining scheduled jobs will be cancelled.
Note that this differs from Coin-2. To emulate Coin-2 behavior, call cc_sched_wait_all() before calling this method.
Set/change the number of threads used by the scheduler.
Returns the number of threads used by the scheduler.
uint32_t cc_sched_schedule | ( | cc_sched * | sched, |
cc_sched_f * | workfunc, | ||
void * | closure, | ||
float | priority | ||
) |
Schedule a new job. A thread calls workfunc with the closure argument when a thread becomes available. larger priority values will be scheduled first.
Returns a schedid that can be used to unschedule the job. schedid is guaranteed to be != 0.
Note that jobs are automatically unscheduled when triggered, just before calling the work function.
SbBool cc_sched_unschedule | ( | cc_sched * | sched, |
uint32_t | schedid | ||
) |
Attempt to unschedule a job. schedid must be an id returned from cc_sched_schedule().
Note that jobs are automatically unscheduled when triggered, just before calling the work function.
Returns TRUE if job was successfully removed, FALSE if job wasn't found in the internal dict.
void cc_sched_wait_all | ( | cc_sched * | sched | ) |
Wait for all scheduled jobs to finish.
Returns the number of remaining scheduled jobs, not counting jobs that are currently being executed (i.e. are in their workfuncs).
Sets the number of allowed jobs per "batch". The scheduler will execute at max the num jobs. To continue executing jobs, call this function again. This is typically done to limit the number of I/O or CPU intensive jobs to a few per frame to avoid starving the main thread.
If num is -1 (the default), the number of jobs per batch is not limited.
void cc_sched_change_priority | ( | cc_sched * | sched, |
uint32_t | schedid, | ||
float | priority | ||
) |
Changes the priority of the given scheduled item.