aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--thread_pthread.c21
2 files changed, 22 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 165082c696..1ea68bdc90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Nov 29 05:54:22 2010 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (native_cond_*): Check return code.
+ (Some OSs except Linux return error code).
+
Sun Nov 28 21:46:21 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread_pthread.c (thread_start_func_1): initialize native thread
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