Improve MS-Windows implementation of threads.
commite57df8f77901a3964d21c3d57fb6769cf4511dc2
authorEli Zaretskii <eliz@gnu.org>
Sat, 31 Aug 2013 11:29:05 +0000 (31 14:29 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 31 Aug 2013 11:29:05 +0000 (31 14:29 +0300)
tree1a748293f62f70a786b9f6c51662e1c132650528
parentdbe17fefccbff010bbbf6c4d0dccc7b2f3a5e201
Improve MS-Windows implementation of threads.

 src/systhread.c (sys_cond_init): Set the 'initialized' member to
 true only if initialization is successful.  Initialize wait_count
 and wait_count_lock.
 (sys_cond_wait, sys_cond_signal, sys_cond_broadcast): If
 'initialized' is false, do nothing.
 (sys_cond_wait): Fix the implementation to avoid the "missed
 wakeup" bug: count the waiting threads, and reset the broadcast
 event once the last thread was released.
 (sys_cond_signal, sys_cond_broadcast): Use SetEvent instead of
 PulseEvent.  Don't signal the event if no threads are waiting.
 (sys_cond_destroy): Only close non-NULL handles.
 (sys_thread_create): Return zero if unsuccessful, 1 if successful.
 src/systhread.h (w32thread_cond_t): New member 'initialized'.
 Rename waiters_count and waiters_count_lock to wait_count and
 wait_count_lock, respectively.
src/ChangeLog
src/process.c
src/systhread.c
src/systhread.h