diff options
author | sewardj <unknown> | 2001-02-06 12:09:42 +0000 |
---|---|---|
committer | sewardj <unknown> | 2001-02-06 12:09:42 +0000 |
commit | 0a49cf2eb15823b5195f68ca89980a22b2d58368 (patch) | |
tree | a6c04fa969b8b0f5f658a4960042b9fb0ed5df58 /ghc/rts/Interpreter.c | |
parent | 0ed9d26049e04d4249f9b7852647c2cac375508c (diff) | |
download | haskell-0a49cf2eb15823b5195f68ca89980a22b2d58368.tar.gz |
[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.
Diffstat (limited to 'ghc/rts/Interpreter.c')
-rw-r--r-- | ghc/rts/Interpreter.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ghc/rts/Interpreter.c b/ghc/rts/Interpreter.c index 99f126b167..cdd9660edb 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 |