From: klueska Date: Wed, 22 Oct 2008 04:45:12 +0000 (+0000) Subject: optimization to join wakeup X-Git-Tag: rc_6_tinyos_2_1_1~586 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=e42551d53cc9fbff637eaffd64edb7db5572d678 optimization to join wakeup --- diff --git a/tos/lib/tosthreads/system/TinyThreadSchedulerP.nc b/tos/lib/tosthreads/system/TinyThreadSchedulerP.nc index ba7f7781..097a7a9a 100644 --- a/tos/lib/tosthreads/system/TinyThreadSchedulerP.nc +++ b/tos/lib/tosthreads/system/TinyThreadSchedulerP.nc @@ -146,19 +146,28 @@ implementation { interrupt(thread); } + void wakeupJoined(thread_t* t) { + int i,j,k; + k = 0; + for(i=0; ijoinedOnMe); i++) { + for(j=0; j<8; j++) { + if(t->joinedOnMe[i] & 0x1) + call ThreadScheduler.wakeupThread(k); + t->joinedOnMe[i] >>= 1; + k++; + } + } + } + /* stop * This routine stops a thread by putting it into the inactive state * and decrementing any necessary variables used to keep track of * threads by the thread scheduler. */ void stop(thread_t* t) { - int i; t->state = TOSTHREAD_STATE_INACTIVE; num_runnable_threads--; - for(i=0; ijoinedOnMe, i)) - call ThreadScheduler.wakeupThread(i); - } + wakeupJoined(t); #ifdef TOSTHREADS_TIMER_OPTIMIZATION post alarmTask(); #else