summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-31 00:11:44 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-31 00:11:44 +0000
commitd3398c196ba03dfceb46d71595e9716a216f6cc1 (patch)
tree68ae4394dd7e3b9a66409cf9b3e9099a7570e77f
parenteff01662e48aecbdab354f93fe7744bb8a90fd8f (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@31832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--thread_pthread.c18
-rw-r--r--version.h2
3 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ee38babc6..0c9b9f6b2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun May 8 19:39:16 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * 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@ruby-lang.org>
* ext/syck/rubyext.c (mktime_do): avoid buffer overrun, by
diff --git a/thread_pthread.c b/thread_pthread.c
index f7c5c2b8ec..d3c2609a12 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -133,10 +133,22 @@ native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
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 @@ thread_timer(void *dummy)
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);
diff --git a/version.h b/version.h
index af471be86a..91e82a74ad 100644
--- a/version.h
+++ b/version.h
@@ -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