From 4295db96b66400decb565c20d55091892616c56d Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 18 Oct 2010 07:34:12 +0000 Subject: [PATCH] more changes towards oooJava version 2 --- Robust/src/Runtime/oooJava/rcr_runtime.c | 5 ++--- Robust/src/Runtime/oooJava/rcr_runtime.h | 2 +- Robust/src/Runtime/workschedule.c | 14 +++++++++++--- Robust/src/buildscript | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Robust/src/Runtime/oooJava/rcr_runtime.c b/Robust/src/Runtime/oooJava/rcr_runtime.c index fb98c848..93530a59 100644 --- a/Robust/src/Runtime/oooJava/rcr_runtime.c +++ b/Robust/src/Runtime/oooJava/rcr_runtime.c @@ -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; } diff --git a/Robust/src/Runtime/oooJava/rcr_runtime.h b/Robust/src/Runtime/oooJava/rcr_runtime.h index 234440d3..afca69dc 100644 --- a/Robust/src/Runtime/oooJava/rcr_runtime.h +++ b/Robust/src/Runtime/oooJava/rcr_runtime.h @@ -3,7 +3,7 @@ extern __thread struct trQueue * TRqueue; -void workerTR(void *); +void * workerTR(void *); #define RCRSIZE 32 diff --git a/Robust/src/Runtime/workschedule.c b/Robust/src/Runtime/workschedule.c index f342bedc..8ed10ef0 100644 --- a/Robust/src/Runtime/workschedule.c +++ b/Robust/src/Runtime/workschedule.c @@ -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 diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 1fce1f64..26c0e815 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -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' ]] -- 2.34.1