Bug #3213
closedConditionVariable#wait in main thread silently returns when a signal is received
Description
=begin
The signal handling implementation unconditionally sets the main thread state to RUNNING and interrupts it (thread.c: 2574). In practice, it means that if the main thread waits for a condition variable, it will resume its execution even though the variable has never been signaled.
(moreover, because of #3212, the CV becomes inconsistent and the thread will get interrupted next time the CV is signalled, even though it is not waiting for the CV).
IMO, a proper signal handling structure would be to wake up the thread only in interruption cases (i.e. when an exception such as Interrupt needs to be raised), but not when a trap is executed.
Though, I do think that condition variables should not silently be released when a signal is received. Worst case, an exception should be raised.
I set the priority to high as this bugs makes condition variables unreliable in practice
=end
Updated by mame (Yusuke Endoh) over 14 years ago
- Status changed from Open to Rejected
=begin
Hi,
This is a spec. Use ConditionVariable#wait in while loop.
See #3212 in detail.
--
Yusuke Endoh mame@tsg.ne.jp
=end