SCIRun
5.0
|
#include <WorkQueue.h>
Public Member Functions | |
WorkQueue (const char *name) | |
Make an empty work queue with no assignments. More... | |
void | refill (int totalAssignments, int nthreads, int granularity=5) |
~WorkQueue () | |
Destroy the work queue. Any unassigned work will be lost. More... | |
bool | nextAssignment (int &start, int &end) |
WorkQueue | ( | const char * | name | ) |
Make an empty work queue with no assignments.
~WorkQueue | ( | ) |
Destroy the work queue. Any unassigned work will be lost.
bool nextAssignment | ( | int & | start, |
int & | end | ||
) |
Called by each thread to get the next assignment. If nextAssignment returns true, the thread has a valid assignment, and then would be responsible for the work from the returned start through end-l. Assignments can range from 0 to totalAssignments-1. When nextAssignment returns false, all work has been assigned.
void refill | ( | int | totalAssignments, |
int | nthreads, | ||
int | granularity = 5 |
||
) |
Fill the work queue with the specified total number of work assignments. num_threads specifies the approximate number of threads which will be working from this queue. The optional granularity specifies the degree to which the tasks are divided. A large granularity will create more assignments with smaller assignments. A granularity of zero will recieve a single assignment of approximately uniform size. name should be a static string which describes the primitive for debugging purposes.