summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@mit.edu>2013-07-08 11:03:35 -0700
committerEdward Z. Yang <ezyang@mit.edu>2013-07-09 11:29:11 -0700
commit70e20631742e516c6a11c3c112fbd5b4a08c15ac (patch)
treed0097f8b1c8e5c0a67b26bb950c036ea7684c65d /rts/Schedule.c
parentca9a431401755f119d97dec59a1fc963a8e9f681 (diff)
downloadhaskell-70e20631742e516c6a11c3c112fbd5b4a08c15ac.tar.gz
Implement atomicReadMVar, fixing #4001.
We add the invariant to the MVar blocked threads queue that threads blocked on an atomic read are always at the front of the queue. This invariant is easy to maintain, since takers are only ever added to the end of the queue. Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 88bfd8c4d3..408146f195 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -947,6 +947,7 @@ scheduleDetectDeadlock (Capability **pcap, Task *task)
case BlockedOnBlackHole:
case BlockedOnMsgThrowTo:
case BlockedOnMVar:
+ case BlockedOnMVarRead:
throwToSingleThreaded(cap, task->incall->tso,
(StgClosure *)nonTermination_closure);
return;
@@ -2843,6 +2844,7 @@ resurrectThreads (StgTSO *threads)
switch (tso->why_blocked) {
case BlockedOnMVar:
+ case BlockedOnMVarRead:
/* Called by GC - sched_mutex lock is currently held. */
throwToSingleThreaded(cap, tso,
(StgClosure *)blockedIndefinitelyOnMVar_closure);