summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-03 12:27:02 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-08-03 12:27:02 +0000
commit194a55259bc5d58b48c00f01030b460072aa7fd3 (patch)
treea8660169418c62752fbb2c6a047c59ecdc2da6eb
parentadbb1c699d730431f0152cd5836231bb83e0014a (diff)
merge revision(s) 1ef39d8d099f145222b9352423af16a2bab6e05b: [Backport #15798]
Fix process not waking up on signals on OpenBSD When using UBF_TIMER_PTHREAD (the UBF handler on OpenBSD), 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. On OpenBSD, this fixes TestThread#test_thread_timer_and_interrupt, and fixes hangs in TestProcess#test_execopts_redirect_open_fifo_interrupt_raise and TestProcess#test_execopts_redirect_open_fifo_interrupt_print. It also fixes the use of Ctrl+C/SIGINT in irb on OpenBSD. It does not cause any test failures on Linux when UBF_TIMER_PTHREAD is forced as the UBF handler. Fixes [Bug #15798] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--thread_pthread.c32
-rw-r--r--version.h4
2 files changed, 22 insertions, 14 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index d8d3184c62..96d2ca9cb3 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -2182,25 +2182,33 @@ timer_pthread_fn(void *p)
pthread_t main_thread_id = vm->main_thread->thread_id;
struct pollfd pfd;
int timeout = -1;
+ int ccp;
pfd.fd = timer_pthread.low[0];
pfd.events = POLLIN;
while (system_working > 0) {
(void)poll(&pfd, 1, timeout);
- (void)consume_communication_pipe(pfd.fd);
+ ccp = consume_communication_pipe(pfd.fd);
- if (system_working > 0 && ATOMIC_CAS(timer_pthread.armed, 1, 1)) {
- pthread_kill(main_thread_id, SIGVTALRM);
-
- if (rb_signal_buff_size() || !ubf_threads_empty()) {
- timeout = TIME_QUANTUM_MSEC;
- }
- else {
- ATOMIC_SET(timer_pthread.armed, 0);
- timeout = -1;
- }
- }
+ if (system_working > 0) {
+ if (ATOMIC_CAS(timer_pthread.armed, 1, 1)) {
+ pthread_kill(main_thread_id, SIGVTALRM);
+
+ if (rb_signal_buff_size() || !ubf_threads_empty()) {
+ timeout = TIME_QUANTUM_MSEC;
+ }
+ else {
+ ATOMIC_SET(timer_pthread.armed, 0);
+ timeout = -1;
+ }
+ }
+ else if (ccp) {
+ pthread_kill(main_thread_id, SIGVTALRM);
+ ATOMIC_SET(timer_pthread.armed, 0);
+ timeout = -1;
+ }
+ }
}
return 0;
diff --git a/version.h b/version.h
index e31a2834d7..b81f9d7aa0 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "2.6.3"
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 75
+#define RUBY_PATCHLEVEL 76
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 1
+#define RUBY_RELEASE_DAY 3
#include "ruby/version.h"