summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-07 13:22:12 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-07 13:22:12 +0000
commitddcd5c2939771129c779bad077bbacc59cd7679a (patch)
tree3fb9645990dda62ac090266a916b39c677bc7164 /thread.c
parent68417aa5ce4e6608da1304dac49dda42503031bf (diff)
r31460 is wrong fix. fix it again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/thread.c b/thread.c
index 0e34d480aa..271795fe9e 100644
--- a/thread.c
+++ b/thread.c
@@ -3423,6 +3423,7 @@ lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms)
break;
}
+ mutex->cond_waiting++;
if (timeout_ms) {
int ret;
struct timespec timeout_rel;
@@ -3434,14 +3435,14 @@ lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms)
ret = native_cond_timedwait(&mutex->cond, &mutex->lock, &timeout);
if (ret == ETIMEDOUT) {
interrupted = 2;
+ mutex->cond_waiting--;
break;
}
}
else {
- mutex->cond_waiting++;
native_cond_wait(&mutex->cond, &mutex->lock);
- mutex->cond_notified--;
}
+ mutex->cond_notified--;
if (RUBY_VM_INTERRUPTED(th)) {
interrupted = 1;