From 0a49cf2eb15823b5195f68ca89980a22b2d58368 Mon Sep 17 00:00:00 2001 From: sewardj Date: Tue, 6 Feb 2001 12:09:42 +0000 Subject: [PATCH] [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. --- ghc/rts/Interpreter.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 -- 1.7.10.4