Fix an extremely subtle deadlock bug on x86_64
authorSimon Marlow <marlowsd@gmail.com>
Thu, 13 Nov 2008 15:57:30 +0000 (15:57 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 13 Nov 2008 15:57:30 +0000 (15:57 +0000)
commit6d31658583b97f84313cc7837a0eaeb4060022a7
tree515b2c9dafccf54aa2ca871827f9c6f97a55b4d0
parent424e0afadc8ed00f96330d869b774acde2865c37
Fix an extremely subtle deadlock bug on x86_64
The recent_activity flag was an unsigned int, but we sometimes do a
64-bit xchg() on it, which overwrites the next word in memory.  This
happened to contain the sched_state flag, which is used to control the
orderly shutdown of the system.  If the xchg() happened during
shutdown, the scheduler would get confused and deadlock.  Don't you
just love C?
rts/Schedule.c
rts/Schedule.h