From d572aed64d9c40dcc38a49b09d18f301555e4efb Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 9 Sep 2008 13:32:23 +0000 Subject: 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. --- rts/Threads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'rts/Threads.c') 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); -- cgit v1.2.1