summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 13:23:17 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-20 13:23:17 +0000
commit32d4fcdc92ebf85c90ab53d9a7743f884e3a623a (patch)
treef0d09dd6da0bf2356364488cbbfd3e0410f7c677 /thread_pthread.c
parent479bf5e516644f4f278da3be13914592f1962eb0 (diff)
merges r29962 from trunk into ruby_1_9_2.
-- * thread_pthread.c (native_cond_*): Check return code. (Some OSs except Linux return error code). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index c2fde5c82e..f7c5c2b8ec 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -106,25 +106,38 @@ native_cond_destroy(pthread_cond_t *cond)
static void
native_cond_signal(pthread_cond_t *cond)
{
- pthread_cond_signal(cond);
+ int r = pthread_cond_signal(cond);
+ if (r != 0) {
+ rb_bug_errno("pthread_cond_signal", r);
+ }
}
static void
native_cond_broadcast(pthread_cond_t *cond)
{
- pthread_cond_broadcast(cond);
+ int r = pthread_cond_broadcast(cond);
+ if (r != 0) {
+ rb_bug_errno("native_cond_broadcast", r);
+ }
}
static void
native_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
- pthread_cond_wait(cond, mutex);
+ int r = pthread_cond_wait(cond, mutex);
+ if (r != 0) {
+ rb_bug_errno("pthread_cond_wait", r);
+ }
}
static int
native_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, struct timespec *ts)
{
- return pthread_cond_timedwait(cond, mutex, ts);
+ int r = pthread_cond_timedwait(cond, mutex, ts);
+ if (r != 0 && r != ETIMEDOUT && r != EINTR /* Linux */) {
+ rb_bug_errno("pthread_cond_timedwait", r);
+ }
+ return r;
}