[MLton] cvs commit: critical sections during thread switch

Stephen Weeks MLton@mlton.org
Fri, 2 Apr 2004 11:15:16 -0800


> When I read GC_gc, it seems to me that if we really need to GC
> (i.e., bytesRequested is greater than limitPlusSlop - frontier)
> while a signal is pending, then we will service the GC but return to
> the current thread, not the signal handler thread.

That's how I read it too.

> Why is
> 		startHandler (s);
> 		switchToThread (s, s->signalHandler);
> under the else and not under it's own if (s->canHandle == 0 and
> s->signalIsPending) ?  That is, shouldn't it be service the GC _and_
> switch to the signal handler if necessary, not service the GC _or_ switch.

That sounds reasonable to me.

> (Now, the GC_gc call that get's inserted from the translation of atomicEnd
> is o.k., becaue it requests 0 bytes, and we always have slop bytes
> available, so we won't GC but will switch to the signal handler.)

I don't think this is true.  Just before the atomicEnd we could have
done some allocation that bumped the frontier past the limit.