- void stop(thread_t* t) {
- t->state = TOSTHREAD_STATE_INACTIVE;
- num_started_threads--;
- if(num_started_threads == 1)
- call PreemptionAlarm.stop();
- signal ThreadCleanup.cleanup[t->id]();
- }
+ void stop(thread_t* t) {
+ t->state = TOSTHREAD_STATE_INACTIVE;
+ num_runnable_threads--;
+ wakeupJoined(t);
+ #ifdef TOSTHREADS_TIMER_OPTIMIZATION
+ post alarmTask();
+ #else
+ if(num_runnable_threads == 1)
+ call PreemptionAlarm.stop();
+ #endif
+ signal ThreadCleanup.cleanup[t->id]();
+ }