From e0ca9137b8fb8d176ba54073428ec739813c0073 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 25 Jan 2002 12:22:27 +0000 Subject: [PATCH] [project @ 2002-01-25 12:22:27 by simonmar] Fix tryTakeMVar - amazingly it only worked with an empty MVar, and this was the only case I tested. oops. Merge to stable. --- ghc/rts/PrimOps.hc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ghc/rts/PrimOps.hc b/ghc/rts/PrimOps.hc index 083031a..d386f84 100644 --- a/ghc/rts/PrimOps.hc +++ b/ghc/rts/PrimOps.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: PrimOps.hc,v 1.87 2001/12/06 13:05:03 sewardj Exp $ + * $Id: PrimOps.hc,v 1.88 2002/01/25 12:22:27 simonmar Exp $ * * (c) The GHC Team, 1998-2000 * @@ -1163,19 +1163,18 @@ FN_(tryTakeMVarzh_fast) /* unlock in the SMP case */ SET_INFO(mvar,&stg_FULL_MVAR_info); #endif - TICK_RET_UNBOXED_TUP(1); - RET_P(val); } else { /* No further putMVars, MVar is now empty */ + mvar->value = (StgClosure *)&stg_END_TSO_QUEUE_closure; /* do this last... we might have locked the MVar in the SMP case, * and writing the info pointer will unlock it. */ SET_INFO(mvar,&stg_EMPTY_MVAR_info); - mvar->value = (StgClosure *)&stg_END_TSO_QUEUE_closure; - TICK_RET_UNBOXED_TUP(1); - RET_P(val); } + + TICK_RET_UNBOXED_TUP(1); + RET_NP((I_)1, val); FE_ } -- 1.7.10.4