In MAKE-THREAD, use WITH-SYSTEM-MUTEX for locking *MAKE-THREAD-LOCK*
authorJan Moringen <jmoringe@techfak.uni-bielefeld.de>
Sun, 23 Jun 2013 17:13:14 +0000 (19:13 +0200)
committerPaul Khuong <pvk@pvk.ca>
Fri, 28 Jun 2013 04:18:16 +0000 (00:18 -0400)
commitb8846766dd1ecb2b6c3dce848f2aae0b3b11a6ea
tree40736fb09aa9b46472422185362c1c85041c171e
parenta5e4dbccec61eec3dcce99b7ad82d09ada64dab3
In MAKE-THREAD, use WITH-SYSTEM-MUTEX for locking *MAKE-THREAD-LOCK*

Otherwise MAKE-THREAD could be interrupted after having
locked *MAKE-THREAD-LOCK*. If the interrupting code also called
MAKE-THREAD, a recursive lock attempt for *MAKE-THREAD-LOCK* would
occur.

The problem could be easily triggered by

  (MAKE-TIMER ... :THREAD <T or a thread>)

Also move let bindings of SETUP-SEM, REAL-FUNCTION, ARGUMENTS and
INITIAL-FUNCTION and the NOT *GC-INHIBIT* assertion out of the
critical section.

Tests have been added in threads.pure.lisp and timer.impure.lisp.

fixes lp#1180102.
src/code/target-thread.lisp
tests/threads.pure.lisp
tests/timer.impure.lisp