[前][次][番号順一覧][スレッド一覧]

ruby-changes:52316

From: normal <ko1@a...>
Date: Fri, 24 Aug 2018 04:49:41 +0900 (JST)
Subject: [ruby-changes:52316] normal:r64524 (trunk): thread_pthread.c (ubf_timer_destroy): remove redundant getpid check

normal	2018-08-24 04:49:35 +0900 (Fri, 24 Aug 2018)

  New Revision: 64524

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64524

  Log:
    thread_pthread.c (ubf_timer_destroy): remove redundant getpid check
    
    TIMER_THREAD_CREATED_P already checks that pid, and glibc 2.25+
    no longer caches getpid(2).

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 64523)
+++ thread_pthread.c	(revision 64524)
@@ -1714,17 +1714,14 @@ static void https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1714
 ubf_timer_destroy(void)
 {
 #if UBF_TIMER == UBF_TIMER_PTHREAD
-    rb_pid_t current = getpid();
-    if (timer_pthread.owner == current) {
-        int err;
+    int err;
 
-        timer_pthread.owner = 0;
-        ubf_timer_disarm();
-        rb_thread_wakeup_timer_thread_fd(timer_pthread.low[1]);
-        err = pthread_join(timer_pthread.thid, 0);
-        if (err) {
-            rb_raise(rb_eThreadError, "native_thread_join() failed (%d)", err);
-        }
+    timer_pthread.owner = 0;
+    ubf_timer_disarm();
+    rb_thread_wakeup_timer_thread_fd(timer_pthread.low[1]);
+    err = pthread_join(timer_pthread.thid, 0);
+    if (err) {
+        rb_raise(rb_eThreadError, "native_thread_join() failed (%d)", err);
     }
 #endif
 /* no need to destroy real POSIX timers */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]