assigns workerID to the workerTR
[IRC.git] / Robust / src / Runtime / oooJava / rcr_runtime.c
1 #include "trqueue.h"
2 #include "coreprof/coreprof.h"
3 #include "mlp_runtime.h"
4 #include "rcr_runtime.h"
5 #include "hashStructure.h"
6 #include "structdefs.h"
7 #include "RuntimeConflictResolver.h"
8
9
10 void * workerTR(void *x) {
11   struct trQueue * queue=(struct trQueue *)x;
12   allHashStructures=queue->allHashStructures;
13   myWorkerID=queue->id;
14
15   CP_CREATE();
16
17   while(1) {
18     SESEcommon * tmp;
19     do {
20       tmp=(SESEcommon *) dequeueTR(queue);
21       if (tmp!=NULL) {
22
23 #ifdef CP_EVENTID_RCR_TRAVERSE
24     CP_LOGEVENT( CP_EVENTID_RCR_TRAVERSE, CP_EVENTTYPE_BEGIN );
25 #endif
26         tasktraverse(tmp);
27
28 #ifdef CP_EVENTID_RCR_TRAVERSE
29     CP_LOGEVENT( CP_EVENTID_RCR_TRAVERSE, CP_EVENTTYPE_END );
30 #endif
31
32       } else {
33         sched_yield();
34       }
35     } while(1);
36   }
37
38   CP_EXIT();
39
40   return NULL;
41 }
42