Changes to accommodate the runtime for multicore gc w/o tasks
[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 extern int threadcount;
32 extern pthread_mutex_t gclock;
33 extern pthread_mutex_t gclistlock;
34 extern pthread_cond_t gccond;
35
36 struct QI {
37   struct QI * next;
38   void * value;
39 };
40
41 struct QI * headqi;
42 struct QI * tailqi;
43
44
45 #endif /* __WORK_SCHEDULE__ */