From: simonmar Date: Thu, 3 Feb 2005 11:21:03 +0000 (+0000) Subject: [project @ 2005-02-03 11:21:03 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~1116 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=30881c00e41f4f43792bbf7bfa3ed8b769295720 [project @ 2005-02-03 11:21:03 by simonmar] Move the in_haskell check to somewhere that works for the threaded RTS too. --- diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 8c0e44e..1aac258 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -358,15 +358,6 @@ schedule( StgMainThread *mainThread USED_WHEN_RTS_SUPPORTS_THREADS, // We might have a capability, passed in as initialCapability. cap = initialCapability; - // Check whether we have re-entered the RTS from Haskell without - // going via suspendThread()/resumeThread (i.e. a 'safe' foreign - // call). - if (in_haskell) { - errorBelch("schedule: re-entered unsafely.\n" - " Perhaps a 'foreign import unsafe' should be 'safe'?"); - stg_exit(1); - } - #if defined(RTS_SUPPORTS_THREADS) // // in the threaded case, the capability is either passed in via the @@ -435,6 +426,15 @@ schedule( StgMainThread *mainThread USED_WHEN_RTS_SUPPORTS_THREADS, // We now have a capability... #endif + // Check whether we have re-entered the RTS from Haskell without + // going via suspendThread()/resumeThread (i.e. a 'safe' foreign + // call). + if (in_haskell) { + errorBelch("schedule: re-entered unsafely.\n" + " Perhaps a 'foreign import unsafe' should be 'safe'?"); + stg_exit(1); + } + // // If we're interrupted (the user pressed ^C, or some other // termination condition occurred), kill all the currently running