sched.h.3coin4 - Man Page

sched.h

Synopsis

#include <Inventor/C/basic.h>
#include <Inventor/C/threads/common.h>

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)

Typedef Documentation

void cc_sched_f

The type definition for the work function called when a thread becomes available.

Function Documentation

cc_sched* cc_sched_construct (int numthreads)

Construct a scheduler that uses numthreads threads.

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.

void cc_sched_set_num_threads (cc_sched * sched, int num)

Set/change the number of threads used by the scheduler.

int cc_sched_get_num_threads (cc_sched * sched)

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.

int cc_sched_get_num_remaining (cc_sched * sched)

Returns the number of remaining scheduled jobs, not counting jobs that are currently being executed (i.e. are in their workfuncs).

void cc_sched_set_num_allowed (cc_sched * sched, int num)

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.

Author

Generated automatically by Doxygen for Coin from the source code.

Info

Sat Aug 1 2020 Version 4.0.0 Coin