X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Ftosthreads%2Fsystem%2FTinyThreadSchedulerP.nc;h=097a7a9a9c550dd9676f0cae85b4c2fc6a85ec73;hb=e42551d53cc9fbff637eaffd64edb7db5572d678;hp=ba7f77812e1c35715ac0cd521897560ffd635f89;hpb=f12c2d7486e586b109ecfe84b2749757e4588a2a;p=tinyos-2.x.git 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