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

ruby-changes:41303

From: nagachika <ko1@a...>
Date: Wed, 30 Dec 2015 04:26:58 +0900 (JST)
Subject: [ruby-changes:41303] nagachika:r53375 (trunk): * thread_pthread.c (rb_thread_create_timer_thread): destroy attr even

nagachika	2015-12-30 04:26:52 +0900 (Wed, 30 Dec 2015)

  New Revision: 53375

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

  Log:
    * thread_pthread.c (rb_thread_create_timer_thread): destroy attr even
      if pthread_create() failed.

  Modified files:
    trunk/ChangeLog
    trunk/thread_pthread.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53374)
+++ ChangeLog	(revision 53375)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Dec 30 04:10:13 2015  CHIKANAGA Tomoyuki  <nagachika@r...>
+
+	* thread_pthread.c (rb_thread_create_timer_thread): destroy attr even
+	  if pthread_create() failed.
+
 Wed Dec 30 02:55:09 2015  Eric Wong  <e@8...>
 
 	* thread_pthread.c (setup_communication_pipe): delay setting owner
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 53374)
+++ thread_pthread.c	(revision 53375)
@@ -1599,6 +1599,7 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1599
 	}
 #ifdef HAVE_PTHREAD_ATTR_INIT
 	err = pthread_create(&timer_thread.id, &attr, thread_timer, &GET_VM()->gvl);
+	pthread_attr_destroy(&attr);
 #else
 	err = pthread_create(&timer_thread.id, NULL, thread_timer, &GET_VM()->gvl);
 #endif
@@ -1617,9 +1618,6 @@ rb_thread_create_timer_thread(void) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1618
 	/* validate pipe on this process */
 	timer_thread_pipe.owner_process = getpid();
 	timer_thread.created = 1;
-#ifdef HAVE_PTHREAD_ATTR_INIT
-	pthread_attr_destroy(&attr);
-#endif
     }
 }
 

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

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