ruby-changes:19787
From: yugui <ko1@a...>
Date: Tue, 31 May 2011 09:11:54 +0900 (JST)
Subject: [ruby-changes:19787] yugui:r31832 (ruby_1_9_2): merges r31482 from trunk into ruby_1_9_2.
yugui 2011-05-31 09:11:44 +0900 (Tue, 31 May 2011) New Revision: 31832 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31832 Log: merges r31482 from trunk into ruby_1_9_2. -- * thread_pthread.c (native_cond_timedwait): add to care EINTR. * thread_pthread.c (thread_timer): remove EINTR check. Modified files: branches/ruby_1_9_2/ChangeLog branches/ruby_1_9_2/thread_pthread.c branches/ruby_1_9_2/version.h Index: ruby_1_9_2/ChangeLog =================================================================== --- ruby_1_9_2/ChangeLog (revision 31831) +++ ruby_1_9_2/ChangeLog (revision 31832) @@ -1,3 +1,8 @@ +Sun May 8 19:39:16 2011 KOSAKI Motohiro <kosaki.motohiro@g...> + + * thread_pthread.c (native_cond_timedwait): add to care EINTR. + * thread_pthread.c (thread_timer): remove EINTR check. + Fri May 6 15:01:11 2011 URABE Shyouhei <shyouhei@r...> * ext/syck/rubyext.c (mktime_do): avoid buffer overrun, by Index: ruby_1_9_2/thread_pthread.c =================================================================== --- ruby_1_9_2/thread_pthread.c (revision 31831) +++ ruby_1_9_2/thread_pthread.c (revision 31832) @@ -133,10 +133,22 @@ static int native_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *ts) { - int r = pthread_cond_timedwait(cond, mutex, ts); - if (r != 0 && r != ETIMEDOUT && r != EINTR /* Linux */) { + int r; + + /* + * An old Linux may return EINTR. Even though POSIX says + * "These functions shall not return an error code of [EINTR]". + * http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cond_timedwait.html + * Let's hide it from arch generic code. + */ + do { + r = pthread_cond_timedwait(cond, mutex, ts); + } while (r == EINTR); + + if (r != 0 && r != ETIMEDOUT) { rb_bug_errno("pthread_cond_timedwait", r); } + return r; } @@ -789,7 +801,7 @@ while (system_working > 0) { int err = WAIT_FOR_10MS(); if (err == ETIMEDOUT); - else if (err == 0 || err == EINTR) { + else if (err == 0) { if (rb_signal_buff_size() == 0) break; } else rb_bug_errno("thread_timer/timedwait", err); Index: ruby_1_9_2/version.h =================================================================== --- ruby_1_9_2/version.h (revision 31831) +++ ruby_1_9_2/version.h (revision 31832) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 249 +#define RUBY_PATCHLEVEL 250 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/