From fdb2b1fd406dddc78902607483961c323787ac9a Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 19 Dec 2003 10:41:14 +0000 Subject: [PATCH] [project @ 2003-12-19 10:41:14 by simonmar] Fix DEBUG & !RTS_SUPPORTS_THREADS build (bogus assertion failure) --- ghc/rts/Capability.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ghc/rts/Capability.c b/ghc/rts/Capability.c index e34f47a..18ef4df 100644 --- a/ghc/rts/Capability.c +++ b/ghc/rts/Capability.c @@ -28,9 +28,10 @@ Capability MainCapability; /* for non-SMP, we have one global capability */ #endif +#if defined(RTS_SUPPORTS_THREADS) + nat rts_n_free_capabilities; -#if defined(RTS_SUPPORTS_THREADS) /* returning_worker_cond: when a worker thread returns from executing an * external call, it needs to wait for an RTS Capability before passing * on the result of the call to the Haskell thread that made it. @@ -107,15 +108,15 @@ static void initCapabilities_(nat n); void initCapabilities( void ) { -#if defined(RTS_SUPPORTS_THREADS) - initCondition(&returning_worker_cond); - initCondition(&thread_ready_cond); -#endif - #if defined(SMP) initCapabilities_(RtsFlags.ParFlags.nNodes); #else initCapability(&MainCapability); +#endif + +#if defined(RTS_SUPPORTS_THREADS) + initCondition(&returning_worker_cond); + initCondition(&thread_ready_cond); rts_n_free_capabilities = 1; #endif @@ -140,8 +141,10 @@ void grabCapability( Capability** cap ) { #if !defined(SMP) +#if defined(RTS_SUPPORTS_THREADS) ASSERT(rts_n_free_capabilities == 1); rts_n_free_capabilities = 0; +#endif *cap = &MainCapability; handleSignalsInThisThread(); #else -- 1.7.10.4