summaryrefslogtreecommitdiff
path: root/rts/Threads.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-09-09 13:32:23 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-09-09 13:32:23 +0000
commitd572aed64d9c40dcc38a49b09d18f301555e4efb (patch)
treef44fa2291ccc16f953a55470a375583d31a0d85f /rts/Threads.c
parent4318aa600015f0d7b4d977cb67071f3f8e7c3b0b (diff)
downloadhaskell-d572aed64d9c40dcc38a49b09d18f301555e4efb.tar.gz
Fix race condition in wakeupThreadOnCapability() (#2574)
wakeupThreadOnCapbility() is used to signal another capability that there is a thread waiting to be added to its run queue. It adds the thread to the (locked) wakeup queue on the remote capability. In order to do this, it has to modify the TSO's link field, which has a write barrier. The write barrier might put the TSO on the mutable list, and the bug was that it was using the mutable list of the *target* capability, which we do not have exclusive access to. We should be using the current Capabilty's mutable list in this case.
Diffstat (limited to 'rts/Threads.c')
-rw-r--r--rts/Threads.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/rts/Threads.c b/rts/Threads.c
index b7f62c8f07..281cb65e48 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -510,7 +510,7 @@ unblockOne_ (Capability *cap, StgTSO *tso,
context_switch = 1;
} else {
// we'll try to wake it up on the Capability it was last on.
- wakeupThreadOnCapability_lock(tso->cap, tso);
+ wakeupThreadOnCapability(cap, tso->cap, tso);
}
#else
appendToRunQueue(cap,tso);