Project

General

Profile

Bug #3213

ConditionVariable#wait in main thread silently returns when a signal is received

Added by sylvain.joyeux (Sylvain Joyeux) over 9 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
ruby -v:
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
[ruby-core:29838]

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

History

#1

Updated by mame (Yusuke Endoh) over 9 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

Also available in: Atom PDF