From cb3508b5f6fc602711ec3c384ecd38cdd8408172 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 19 Feb 2008 10:22:12 +0000 Subject: [PATCH] Fix #1984: missing context switches --- rts/Schedule.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 3a45495..1bd68c2 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1634,7 +1634,16 @@ scheduleHandleHeapOverflow( Capability *cap, StgTSO *t ) } #endif - pushOnRunQueue(cap,t); + if (context_switch) { + // Sometimes we miss a context switch, e.g. when calling + // primitives in a tight loop, MAYBE_GC() doesn't check the + // context switch flag, and we end up waiting for a GC. + // See #1984, and concurrent/should_run/1984 + context_switch = 0; + addToRunQueue(cap,t); + } else { + pushOnRunQueue(cap,t); + } return rtsTrue; /* actual GC is done at the end of the while loop in schedule() */ } -- 1.7.10.4