projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2002-11-22 13:59:40 by simonmar]
[ghc-hetmet.git]
/
ghc
/
rts
/
Task.c
diff --git
a/ghc/rts/Task.c
b/ghc/rts/Task.c
index
bf20e99
..
bc701b0
100644
(file)
--- a/
ghc/rts/Task.c
+++ b/
ghc/rts/Task.c
@@
-46,7
+46,6
@@
static nat maxTasks;
/* number of tasks currently created */
static nat taskCount;
/* number of tasks currently created */
static nat taskCount;
-
#if defined(SMP)
void
startTaskManager( nat maxCount, void (*taskStart)(void) )
#if defined(SMP)
void
startTaskManager( nat maxCount, void (*taskStart)(void) )
@@
-100,6
+99,7
@@
void
stopTaskManager ()
{
nat i;
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
/* Don't want to use pthread_cancel, since we'd have to install
* these silly exception handlers (pthread_cleanup_{push,pop}) around
@@
-120,9
+120,12
@@
stopTaskManager ()
#endif
/* Send 'em all a SIGHUP. That should shut 'em up. */
#endif
/* Send 'em all a SIGHUP. That should shut 'em up. */
- await_death = maxCount;
+ await_death = maxCount - 1;
for (i = 0; i < maxCount; i++) {
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();
}
while (await_death > 0) {
sched_yield();
@@
-135,7
+138,8
@@
stopTaskManager ()
/************ THREADS version *****************/
void
/************ THREADS version *****************/
void
-startTaskManager( nat maxCount, void (*taskStart)(void) )
+startTaskManager( nat maxCount,
+ void (*taskStart)(void) STG_UNUSED )
{
/* In the threaded case, maxCount is used to limit the
the creation of worker tasks. Tasks are created lazily, i.e.,
{
/* In the threaded case, maxCount is used to limit the
the creation of worker tasks. Tasks are created lazily, i.e.,
@@
-152,8
+156,6
@@
startTask ( void (*taskStart)(void) )
int r;
OSThreadId tid;
int r;
OSThreadId tid;
- /* Locks assumed: rts_mutex */
-
/* If more than one worker thread is known to be blocked waiting
on thread_ready_cond, signal it rather than creating a new one.
*/
/* If more than one worker thread is known to be blocked waiting
on thread_ready_cond, signal it rather than creating a new one.
*/
@@
-184,6
+186,8
@@
startTask ( void (*taskStart)(void) )
return;
}
return;
}
+
+
void
stopTaskManager ()
{
void
stopTaskManager ()
{