From: sewardj Date: Tue, 6 Feb 2001 12:09:42 +0000 (+0000) Subject: [project @ 2001-02-06 12:09:42 by sewardj] X-Git-Tag: Approximately_9120_patches~2733 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0a49cf2eb15823b5195f68ca89980a22b2d58368;p=ghc-hetmet.git [project @ 2001-02-06 12:09:42 by sewardj] Check the context_switch flag and yield if set, so that interpreted code behaves properly in a multi(haskell)threaded environment. --- diff --git a/ghc/rts/Interpreter.c b/ghc/rts/Interpreter.c index 99f126b..cdd9660 100644 --- a/ghc/rts/Interpreter.c +++ b/ghc/rts/Interpreter.c @@ -5,8 +5,8 @@ * Copyright (c) 1994-2000. * * $RCSfile: Interpreter.c,v $ - * $Revision: 1.15 $ - * $Date: 2001/02/06 12:02:05 $ + * $Revision: 1.16 $ + * $Date: 2001/02/06 12:09:42 $ * ---------------------------------------------------------------------------*/ #ifdef GHCI @@ -383,7 +383,16 @@ StgThreadReturnCode interpretBCO ( Capability* cap ) cap->rCurrentTSO->what_next = ThreadEnterInterp; RETURN(StackOverflow); } + + /* Context-switch check */ + if (context_switch) { + iSp--; + StackWord(0) = (W_)obj; + cap->rCurrentTSO->what_next = ThreadEnterInterp; + RETURN(ThreadYielding); + } + # ifdef INTERP_STATS it_lastopc = 0; /* no opcode */ # endif