diff options
| author | wolfgang <unknown> | 2003-10-01 10:49:09 +0000 |
|---|---|---|
| committer | wolfgang <unknown> | 2003-10-01 10:49:09 +0000 |
| commit | 324e96d2ebfcb113cd97c43ef043d591ef87de71 (patch) | |
| tree | b5b38d8ec16bc56010132ef73710577e85122952 /ghc/rts/Select.c | |
| parent | aefc6956f4828708e1343cf4858296fc3141a176 (diff) | |
| download | haskell-324e96d2ebfcb113cd97c43ef043d591ef87de71.tar.gz | |
[project @ 2003-10-01 10:49:07 by wolfgang]
Threaded RTS:
Don't start new worker threads earlier than necessary.
After this commit, a Haskell program that uses neither forkOS nor forkIO is
really single-threaded (rather than using two OS threads internally).
Some details:
Worker threads are now only created when a capability is released, and
only when
(there are no worker threads)
&& (there are runnable Haskell threads ||
there are Haskell threads blocked on IO or threadDelay)
awaitEvent can now be called from bound thread scheduling loops
(so that we don't have to create a worker thread just to run awaitEvent)
Diffstat (limited to 'ghc/rts/Select.c')
| -rw-r--r-- | ghc/rts/Select.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ghc/rts/Select.c b/ghc/rts/Select.c index 677fdd2c81..d7e6ffcdaa 100644 --- a/ghc/rts/Select.c +++ b/ghc/rts/Select.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Select.c,v 1.29 2003/06/26 12:22:59 stolz Exp $ + * $Id: Select.c,v 1.30 2003/10/01 10:49:09 wolfgang Exp $ * * (c) The GHC Team 1995-2002 * @@ -351,4 +351,20 @@ wakeBlockedWorkerThread() workerWakeupPending = rtsTrue; } } + +/* resetWorkerWakeupPipeAfterFork + * + * To be called right after a fork(). + * After the fork(), the worker wakeup pipe will be shared + * with the parent process, and that's something we don't want. + */ +void +resetWorkerWakeupPipeAfterFork() +{ + if(workerWakeupInited) { + close(workerWakeupPipe[0]); + close(workerWakeupPipe[1]); + } + workerWakeupInited = rtsFalse; +} #endif |
