more changes towards oooJava version 2
authorbdemsky <bdemsky>
Mon, 18 Oct 2010 07:34:12 +0000 (07:34 +0000)
committerbdemsky <bdemsky>
Mon, 18 Oct 2010 07:34:12 +0000 (07:34 +0000)
Robust/src/Runtime/oooJava/rcr_runtime.c
Robust/src/Runtime/oooJava/rcr_runtime.h
Robust/src/Runtime/workschedule.c
Robust/src/buildscript

index fb98c8482a193f35703baa0749786436a8b6e959..93530a599cae1a581c9be9f5e08edda0f14d19a2 100644 (file)
@@ -2,9 +2,7 @@
 #include "rcr_runtime.h"
 #include "mlp_runtime.h"
 
-__thread struct trQueue * TRqueue;
-
-void workerTR(void *x) {
+void * workerTR(void *x) {
   struct trQueue * queue=(struct trQueue *)x;
   while(1) {
     SESEcommon * tmp;
@@ -17,4 +15,5 @@ void workerTR(void *x) {
     
     
   }
+  return NULL;
 }
index 234440d3891bac812c138ab4900b5e4d7fea6b5b..afca69dc8874981811d87c31a6603aa690199c47 100644 (file)
@@ -3,7 +3,7 @@
 
 extern __thread struct trQueue * TRqueue;
 
-void workerTR(void *);
+void workerTR(void *);
 
 #define RCRSIZE 32
 
index f342bedc1123808477c71c0270c8456b88ebfed5..8ed10ef0108c79d679b08c16eac0bc335794e657 100644 (file)
@@ -8,6 +8,7 @@
 #include "coreprof/coreprof.h"
 #ifdef RCR
 #include "rcr_runtime.h"
+#include "trqueue.h"
 #endif
 
 // NOTE: Converting this from a work-stealing strategy
@@ -55,7 +56,7 @@ __thread int oid;
 
 #ifdef RCR
 #include "trqueue.h"
-__thread struct trqueue * TRqueue;
+__thread struct trQueue * TRqueue=NULL;
 #endif
 
 
@@ -85,8 +86,9 @@ void* workerMain( void* arg ) {
   pthread_attr_t nattr;  
   pthread_attr_init(&nattr);
   pthread_attr_setdetachstate(&nattr, PTHREAD_CREATE_DETACHED);
-  TRqueue=allocTR();
-  int status = pthread_create( &(workerDataArray[i].workerThread), 
+  if (TRqueue==NULL)
+    TRqueue=allocTR();
+  int status = pthread_create( &thread,
                               NULL,
                               workerTR,
                               (void*) TRqueue);
@@ -184,6 +186,12 @@ void workScheduleInit( int numProcessors,
   // this code) will become a worker thread after setup
   workerDataArray = RUNMALLOC( sizeof( WorkerData ) * (numWorkers+1) );
 
+#ifdef RCR
+  //make sure the queue is initialized
+  if (TRqueue==NULL)
+    TRqueue=allocTR();
+#endif
+
   for( i = 0; i < numWorkers; ++i ) {
 
     // the original thread is ID 1, start counting from there
index 1fce1f642952de42e1cbb8ae4b9a33f29aba6cf8..26c0e8159680ff41ce183155276e70aff95a8ffa 100755 (executable)
@@ -568,7 +568,7 @@ elif [[ $1 = '-rcr' ]]
 then
 JAVAOPTS="$JAVAOPTS -rcr"
 RCR=true
-EXTRAOPTIONS="$EXTRAOPTIONS -I$ROBUSTROOT/Runtime/oooJava"
+EXTRAOPTIONS="$EXTRAOPTIONS -DRCR -I$ROBUSTROOT/Runtime/oooJava"
 
 
 elif [[ $1 = '-coreprof' ]]