aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--thread.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 38e9330e40..0ca0cff4bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sat May 7 15:18:06 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ fix incorrect native_cond_signal call when deadlock was detected.
+
+ * thread.c (lock_func): timedwait don't touch cond_waiting and
+ cond_notifid variables.
+
Sat May 7 15:15:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
fix win32 native_cond_timedwait() makes SIGSEGV.
diff --git a/thread.c b/thread.c
index 0bdc4ef6bf..0e34d480aa 100644
--- a/thread.c
+++ b/thread.c
@@ -3423,7 +3423,6 @@ 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;
@@ -3439,9 +3438,10 @@ lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms)
}
}
else {
+ mutex->cond_waiting++;
native_cond_wait(&mutex->cond, &mutex->lock);
+ mutex->cond_notified--;
}
- mutex->cond_notified--;
if (RUBY_VM_INTERRUPTED(th)) {
interrupted = 1;