Issue #15798 has been updated by jeremyevans0 (Jeremy Evans).


I've tested on Linux when forcing UBF_TIMER_PTHREAD.  While the patch does not appear to be necessary on Linux, there are no regressions in the tests when using it, so it should be safe.  It does fix the annoying current behavior on OpenBSD, so I hope a committer can review and commit it.

----------------------------------------
Bug #15798: Fix threads not waking up on SIGINT when using UBF_TIMER_PTHREAD
https://bugs.ruby-lang.org/issues/15798#change-78044

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0dev (2019-04-26 trunk e804fcb42c) [x86_64-openbsd]
* Backport: 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>