diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-11-11 14:28:22 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-11-11 14:28:22 +0000 |
commit | 2d5e052d795c99c17b1ca6fa1ca8be7d082be09c (patch) | |
tree | 6eabbfd2ceeb75f8c481d1872e46fa3c6b88bf9d /rts/posix/Signals.c | |
parent | cd0e2c0cc3005c3f5e74eeda57dc9cebbe1bac7e (diff) | |
download | haskell-2d5e052d795c99c17b1ca6fa1ca8be7d082be09c.tar.gz |
Second attempt to fix #1185 (forkProcess and -threaded)
Patch 1/2: second part of the patch is to libraries/base
This time without dynamic linker hacks, instead I've expanded the
existing rts/Globals.c to cache more CAFs, specifically those in
GHC.Conc. We were already using this trick for signal handlers, I
should have realised before.
It's still quite unsavoury, but we can do away with rts/Globals.c in
the future when we switch to a dynamically-linked GHCi.
Diffstat (limited to 'rts/posix/Signals.c')
-rw-r--r-- | rts/posix/Signals.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 660065734b..3b93fccbb7 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -86,18 +86,16 @@ static int io_manager_pipe = -1; #define IO_MANAGER_WAKEUP 0xff #define IO_MANAGER_DIE 0xfe +#define IO_MANAGER_SYNC 0xfd void setIOManagerPipe (int fd) { // only called when THREADED_RTS, but unconditionally // compiled here because GHC.Conc depends on it. - if (io_manager_pipe < 0) { - io_manager_pipe = fd; - } + io_manager_pipe = fd; } -#if defined(THREADED_RTS) void ioManagerWakeup (void) { @@ -111,6 +109,19 @@ ioManagerWakeup (void) } void +ioManagerSync (void) +{ + int r; + // Wake up the IO Manager thread by sending a byte down its pipe + if (io_manager_pipe >= 0) { + StgWord8 byte = (StgWord8)IO_MANAGER_SYNC; + r = write(io_manager_pipe, &byte, 1); + if (r == -1) { sysErrorBelch("ioManagerSync: write"); } + } +} + +#if defined(THREADED_RTS) +void ioManagerDie (void) { int r; |