From 8b75acd3ca25165536f18976c8d80cb62ad613e4 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 6 Dec 2011 11:38:07 +0000 Subject: Make forkProcess work with +RTS -N Consider this experimental for the time being. There are a lot of things that could go wrong, but I've verified that at least it works on the test cases we have. I also did some API cleanups while I was here. Previously we had: Capability * rts_eval (Capability *cap, HaskellObj p, /*out*/HaskellObj *ret); but this API is particularly error-prone: if you forget to discard the Capability * you passed in and use the return value instead, then you're in for subtle bugs with +RTS -N later on. So I changed all these functions to this form: void rts_eval (/* inout */ Capability **cap, /* in */ HaskellObj p, /* out */ HaskellObj *ret) It's much harder to use this version incorrectly, because you have to pass the Capability in by reference. --- rts/posix/Signals.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'rts/posix/Signals.c') diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 9f5bf9f370..38c9792552 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -145,11 +145,10 @@ ioManagerDie (void) } } -Capability * -ioManagerStartCap (Capability *cap) +void +ioManagerStartCap (Capability **cap) { - return rts_evalIO( - cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL); + rts_evalIO(cap,&base_GHCziConcziIO_ensureIOManagerIsRunning_closure,NULL); } void @@ -159,7 +158,7 @@ ioManagerStart (void) Capability *cap; if (io_manager_control_fd < 0 || io_manager_wakeup_fd < 0) { cap = rts_lock(); - cap = ioManagerStartCap(cap); + ioManagerStartCap(&cap); rts_unlock(cap); } } -- cgit v1.2.1