changes.
[IRC.git] / Robust / src / Runtime / workschedule.h
1 #ifndef __WORK_SCHEDULE__
2 #define __WORK_SCHEDULE__
3
4
5 // initialize the work schedule system, after
6 // which some preliminary work units can be
7 // scheduled.  Note the supplied work func
8 // should operate on a work unit of the type
9 // submitted in the function below
10 void workScheduleInit(int numProcessors,
11                       void (*workFunc)(void*) );
12
13 // as the scheduler evolves, looks like this is
14 // a better way to shut down the system
15 void workScheduleExit();
16
17
18 // your main program, before beginning this
19 // system, or the execution of worker threads
20 // themselves use this submit function to
21 // distribute work units among the worker pool
22 // threads.  The workers will dynamically
23 // steal from one another to load balance
24 void workScheduleSubmit(void* workUnit);
25
26 // once you call this begin function your main
27 // thread becomes a work thread, so programs
28 // should not expect to return from this
29 void workScheduleBegin();
30
31
32
33 // this is a pattern where whatever the
34 // driving runtime component is for your compiler
35 // mode should provide the following synchronization
36 // variables to share with the garbage collector
37 // (so thread.c has them and uses them, too)
38 // and the key is you must coordinate with the garbage
39 // collector when the runtime wants to block threads
40 extern int threadcount;
41 extern pthread_mutex_t gclock;
42 extern pthread_mutex_t gclistlock;
43 extern pthread_cond_t gccond;
44
45
46 #endif /* __WORK_SCHEDULE__ */