thrGetJobs

Return a list of jobs in a given state

Description:

This function returns a list containing the identifiers for all job currently in the specified state. This is a snapshot at the moment this function is called. Jobs may have changed state by the time the calling function gets round to processing the returned list.

Invocation

int thrGetJobs( ThrWorkForce workforce, int state, int njob, int status )

Arguments

workforce
Pointer to the workforce. NULL should be supplied if this function is called from within a job executing in a worker thread.
state
An integer in which each bit is a boolean flag indicating if jobs in a particular state should be included in the returned list. The supplied value should be the union of one or more of the following values defined in header file " thr.h" :

THR__ACTIVE: active jobs that are currently running or halted THR__AVAILABLE: inactive jobs that have not yet been started but are available to run as soon as a worker becomes available. THR__FINISHED: inactive jobs that have finished running and are awaiting other jobs to finish before being freed. THR__WAITING: inactive jobs that are waiting for other jobs to finish before being started

njob
Pointer to an int in which to return the length of the returned list of job identifier.
status
Pointer to the inherited status value.

Returned Value

A pointer to a newly allocated list of job identifier. Its length
is given by the value returned in " njob" . It should be freed using
astFree when no longer needed. A NULL pointer will be returned if an
error occurrs.