Project

General

Profile

Actions

Bug #15798

closed

Fix threads not waking up on SIGINT when using UBF_TIMER_PTHREAD

Added by jeremyevans0 (Jeremy Evans) almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-04-26 trunk e804fcb42c) [x86_64-openbsd]
[ruby-core:92428]

Description

When using UBF_TIMER_PTHREAD, the timer_pthread_fn function will
not signal the main thread with SIGVTALRM in cases where
timer_pthread is armed before consume_communication_pipe is called.
This is because consume_communication_pipe will unarm the timer.

Fix this by checking the return value of consume_communication_pipe.
If it returns TRUE and the timer_pthread is disarmed, then signal
the main thread with SIGVTALRM.

This fixes TestThread#test_thread_timer_and_interrupt. It also
fixes the use of Ctrl+C/SIGINT in irb on OpenBSD, and I'm guessing
other platforms that use UBF_TIMER_PTHREAD. Previously,
you could hit Ctrl+C multiple times and it would do nothing until
another key was pressed (even Backspace).

If this is determined to be the correct fix, this should be
backported to 2.6, but it is not a problem in earlier versions.


Files

fix-pthread-timer.patch (2.43 KB) fix-pthread-timer.patch jeremyevans0 (Jeremy Evans), 04/26/2019 11:31 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0