/* number of tasks currently created */
static nat taskCount;
-
#if defined(SMP)
void
startTaskManager( nat maxCount, void (*taskStart)(void) )
stopTaskManager ()
{
nat i;
+ OSThreadId tid = osThreadId();
/* Don't want to use pthread_cancel, since we'd have to install
* these silly exception handlers (pthread_cleanup_{push,pop}) around
#endif
/* Send 'em all a SIGHUP. That should shut 'em up. */
- await_death = maxCount;
+ await_death = maxCount - 1;
for (i = 0; i < maxCount; i++) {
- pthread_kill(taskTable[i].id,SIGTERM);
+ /* don't cancel the thread running this piece of code. */
+ if ( taskTable[i].id != tid ) {
+ pthread_kill(taskTable[i].id,SIGTERM);
+ }
}
while (await_death > 0) {
sched_yield();
return;
}
+
+
void
stopTaskManager ()
{