summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-28 12:55:43 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-28 12:55:43 +0000
commit7a4b99129b1e05221add4132533a92de4c454da3 (patch)
treea6b2514c5e7e3c893a070e012cf5781b175bc62b /thread_pthread.c
parent16d4733ee49d749e4dad3de896a3f02e0573eeff (diff)
* 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/trunk@29962 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 797399b97e..054e7034dc 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -259,25 +259,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;
}
static void