Fix race condition in wakeupThreadOnCapability() (#2574)
authorSimon Marlow <marlowsd@gmail.com>
Tue, 9 Sep 2008 13:32:23 +0000 (13:32 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 9 Sep 2008 13:32:23 +0000 (13:32 +0000)
commitd572aed64d9c40dcc38a49b09d18f301555e4efb
treef44fa2291ccc16f953a55470a375583d31a0d85f
parent4318aa600015f0d7b4d977cb67071f3f8e7c3b0b
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/Capability.c
rts/Capability.h
rts/Schedule.c
rts/Schedule.h
rts/Threads.c