I think I fixed this in trunk revision 110318.  The problem was that
the call to term_ntproc, as part of shutting down Emacs, deleted the
critical sections used by the timer threads and by setitimer, so any
call to setitimer after that would use an invalid critical section
object.  I now make sure any calls to setitimer after deleting the
critical sections will return immediately without doing anything.


The explanation seems fine. The experimentation too : I did a bootstrap
(64bits full optimization). It ran smoothly.

Great job.

Fabrice