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

ruby-changes:27674

From: nagachika <ko1@a...>
Date: Tue, 12 Mar 2013 00:51:57 +0900 (JST)
Subject: [ruby-changes:27674] nagachika:r39726 (ruby_2_0_0): merge revision(s) 39680,39681: [Backport #8063]

nagachika	2013-03-12 00:51:44 +0900 (Tue, 12 Mar 2013)

  New Revision: 39726

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

  Log:
    merge revision(s) 39680,39681: [Backport #8063]
    
    * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
      ifdef condtions.
    
    * thread_pthread.c (timer_thread_sleep): use poll() instead of
      select(). select doesn't work if timer_thread_pipe[0] is
      greater than FD_SETSIZE.
    
    * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): add a dependency
      against poll.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/thread_pthread.c
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 39725)
+++ ruby_2_0_0/ChangeLog	(revision 39726)
@@ -1,3 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Tue Mar 12 00:51:23 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread_pthread.c (timer_thread_sleep): use poll() instead of
+	  select(). select doesn't work if timer_thread_pipe[0] is
+	  greater than FD_SETSIZE.
+	* thread_pthread.c (USE_SLEEPY_TIMER_THREAD): add a dependency
+	  against poll.
+
+Tue Mar 12 00:51:23 2013  KOSAKI Motohiro  <kosaki.motohiro@g...>
+
+	* thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
+	  ifdef condtions.
+
 Mon Mar 11 01:16:12 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (unexpand_shvar): get rid of non-portable shell
Index: ruby_2_0_0/thread_pthread.c
===================================================================
--- ruby_2_0_0/thread_pthread.c	(revision 39725)
+++ ruby_2_0_0/thread_pthread.c	(revision 39726)
@@ -30,6 +30,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread_pthread.c#L30
 #if defined(__native_client__) && defined(NACL_NEWLIB)
 # include "nacl/select.h"
 #endif
+#if HAVE_POLL
+#include <poll.h>
+#endif
 
 static void native_mutex_lock(pthread_mutex_t *lock);
 static void native_mutex_unlock(pthread_mutex_t *lock);
@@ -53,12 +56,11 @@ static pthread_t timer_thread_id; https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread_pthread.c#L56
 #define USE_MONOTONIC_COND 0
 #endif
 
-#ifdef __native_client__
-/* Doesn't have select(1). */
-# define USE_SLEEPY_TIMER_THREAD 0
-#else
+#if defined(HAVE_POLL) && defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL) && defined(O_NONBLOCK) && !defined(__native_client__)
 /* The timer thread sleeps while only one Ruby thread is running. */
 # define USE_SLEEPY_TIMER_THREAD 1
+#else
+# define USE_SLEEPY_TIMER_THREAD 0
 #endif
 
 static void
@@ -1218,23 +1220,20 @@ timer_thread_sleep(rb_global_vm_lock_t* https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread_pthread.c#L1220
 {
     int result;
     int need_polling;
-    struct timeval timeout;
-    fd_set rfds;
-    FD_ZERO(&rfds);
-    FD_SET(timer_thread_pipe[0], &rfds);
+    struct pollfd pollfd;
+
+    pollfd.fd = timer_thread_pipe[0];
+    pollfd.events = POLLIN;
 
     need_polling = check_signal_thread_list();
 
     if (gvl->waiting > 0 || need_polling) {
-	timeout.tv_sec = 0;
-	timeout.tv_usec = TIME_QUANTUM_USEC;
-
 	/* polling (TIME_QUANTUM_USEC usec) */
-	result = select(timer_thread_pipe[0] + 1, &rfds, 0, 0, &timeout);
+	result = poll(&pollfd, 1, TIME_QUANTUM_USEC/1000);
     }
     else {
 	/* wait (infinite) */
-	result = select(timer_thread_pipe[0] + 1, &rfds, 0, 0, 0);
+	result = poll(&pollfd, 1, -1);
     }
 
     if (result == 0) {
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 39725)
+++ ruby_2_0_0/version.h	(revision 39726)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-03-11"
-#define RUBY_PATCHLEVEL 54
+#define RUBY_RELEASE_DATE "2013-03-12"
+#define RUBY_PATCHLEVEL 55
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 3
-#define RUBY_RELEASE_DAY 11
+#define RUBY_RELEASE_DAY 12
 
 #include "ruby/version.h"
 

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39680-39681


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

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