ruby-changes:52182
From: normal <ko1@a...>
Date: Thu, 16 Aug 2018 18:16:16 +0900 (JST)
Subject: [ruby-changes:52182] normal:r64390 (trunk): thread.c (consume_communication_pipe): disarm UBF_TIMER before consume
normal 2018-08-16 18:16:11 +0900 (Thu, 16 Aug 2018) New Revision: 64390 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64390 Log: thread.c (consume_communication_pipe): disarm UBF_TIMER before consume Same reasoning as the disarm in rb_sigwait_fd_get, the current thread is already processing signals, so we do not need UBF_TIMER to continually kick the process, anymore. Modified files: trunk/thread.c trunk/thread_win32.c Index: thread.c =================================================================== --- thread.c (revision 64389) +++ thread.c (revision 64390) @@ -4269,6 +4269,14 @@ consume_communication_pipe(int fd) https://github.com/ruby/ruby/blob/trunk/thread.c#L4269 ssize_t result; int ret = FALSE; /* for rb_sigwait_sleep */ + /* + * disarm UBF_TIMER before we read, because it can become + * re-armed at any time via sighandler and the pipe will refill + * We can disarm it because this thread is now processing signals + * and we do not want unnecessary SIGVTALRM + */ + ubf_timer_disarm(); + while (1) { result = read(fd, buff, sizeof(buff)); if (result > 0) { Index: thread_win32.c =================================================================== --- thread_win32.c (revision 64389) +++ thread_win32.c (revision 64390) @@ -22,6 +22,7 @@ https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L22 #define unregister_ubf_list(th) #define ubf_wakeup_all_threads() do {} while (0) #define ubf_threads_empty() (1) +#define ubf_timer_disarm() do {} while (0) static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/