Fix a bug with signaling a thread that waits for condvar
commit5fefaaa8c0696ba4b7b6e1e89267aa10fff88b31
authorEli Zaretskii <eliz@gnu.org>
Wed, 18 Jan 2017 16:06:42 +0000 (18 18:06 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 18 Jan 2017 16:06:42 +0000 (18 18:06 +0200)
treea6206b902d88eefec0fbed6644d3a6648fcae448
parent571532605bc0db221c76e36067435e4355e0d1a1
Fix a bug with signaling a thread that waits for condvar

* src/thread.c (lisp_mutex_lock_for_thread): New function,
with all the guts of lisp_mutex_lock.
(lisp_mutex_lock): Call lisp_mutex_lock_for_thread.
(condition_wait_callback): Don't call post_acquire_global_lock
before locking the mutex, as that could cause a signaled thread to
exit prematurely, because the condvar's mutex is recorded to be
not owned by any thread, and with-mutex wants to unlock it as part
of unwinding the stack in response to the signal.
src/thread.c