threads are the bug

Stephen Weeks MLton@sourcelight.com
Thu, 5 Jul 2001 18:30:50 -0700


> > OK.  I now have the following in gc.h
> >
> > 	volatile int canHandle;
> > 	volatile bool signalIsPending;
> 
> Does this impact the assembly version of thread_SwitchTo?  For reasons
> completely independent of their volatility, the register allocator should
> manipulate those two variables directly in memory (in each basic block
> where they are used, there is exactly one use, so the allocator shouldn't
> bother pulling them into a register).

I don't think it matters.  The bug was only caused because Thread_atomicBegin
relies on the fact that the store of canHandle happens before the load of
signalIsPending.  In the case of Thread_atomicEnd, it doesn't matter (because if
they happen out of order and the signal handler happens in the middle, it sets
limit to base anyway).