[project @ 2005-02-15 11:39:52 by simonmar]
authorsimonmar <unknown>
Tue, 15 Feb 2005 11:39:52 +0000 (11:39 +0000)
committersimonmar <unknown>
Tue, 15 Feb 2005 11:39:52 +0000 (11:39 +0000)
remove race conditions in the recent in_haskell sanity check code

ghc/rts/Schedule.c

index 89ba7d4..6f4e5f9 100644 (file)
@@ -1600,10 +1600,10 @@ suspendThread( StgRegTable *reg )
   IF_DEBUG(scheduler, sched_belch("worker (token %d): leaving RTS", tok));
 #endif
 
+  in_haskell = rtsFalse;
   RELEASE_LOCK(&sched_mutex);
   
   errno = saved_errno;
-  in_haskell = rtsFalse;
   return tok; 
 }
 
@@ -1648,9 +1648,9 @@ resumeThread( StgInt tok )
   tso->why_blocked  = NotBlocked;
 
   cap->r.rCurrentTSO = tso;
+  in_haskell = rtsTrue;
   RELEASE_LOCK(&sched_mutex);
   errno = saved_errno;
-  in_haskell = rtsTrue;
   return &cap->r;
 }