From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS shortcircuit=no autolearn=no autolearn_force=no version=3.4.1 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A6F1B1F453; Sun, 23 Sep 2018 08:41:40 +0000 (UTC) From: Eric Wong To: spew@80x24.org Cc: Eric Wong Subject: [PATCH] thread_pthread.c: check and reset interrupts for UBF_TIMER_PTHREAD Date: Sun, 23 Sep 2018 08:41:38 +0000 Message-Id: <20180923084138.8015-1-e@80x24.org> List-Id: The pthread for UBF_TIMER_PTHREAD can access all the ubf_list stuff safely, so more closely mimic the <2.5 timer thread call. Maybe the "timer_thread_function()" call is unnecesary (and if it IS necessary, it may be hiding another bug). [Bug #15130] --- thread_pthread.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/thread_pthread.c b/thread_pthread.c index 1fee4989c0..f405dedc26 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -2063,7 +2063,6 @@ static void * timer_pthread_fn(void *p) { rb_vm_t *vm = p; - pthread_t main_thread_id = vm->main_thread->thread_id; struct pollfd pfd; int timeout = -1; @@ -2075,8 +2074,6 @@ timer_pthread_fn(void *p) (void)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; } @@ -2084,6 +2081,11 @@ timer_pthread_fn(void *p) ATOMIC_SET(timer_pthread.armed, 0); timeout = -1; } + /* timer function */ + ubf_wakeup_all_threads(); + if ("maybe unnecessary...") + timer_thread_function(); + rb_threadptr_check_signal(vm->main_thread); } } -- EW