r31460 is wrong fix. fix it again.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2011-05-07 13:22:12 +00:00
parent 68417aa5ce
commit ddcd5c2939
2 changed files with 8 additions and 8 deletions

View File

@ -1,3 +1,8 @@
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): decrement cond_waiting if timeout was happen.
Sat May 7 18:28:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat May 7 18:28:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread_pthread.c (USE_MONOTONIC_COND): check the availability * thread_pthread.c (USE_MONOTONIC_COND): check the availability
@ -5,12 +10,6 @@ Sat May 7 18:28:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* thread_pthread.h (rb_thread_cond_t): ditto. * thread_pthread.h (rb_thread_cond_t): ditto.
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_notified variables.
Sat May 7 15:15:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com> Sat May 7 15:15:10 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
fix win32 native_cond_timedwait() makes SIGSEGV. fix win32 native_cond_timedwait() makes SIGSEGV.

View File

@ -3423,6 +3423,7 @@ lock_func(rb_thread_t *th, mutex_t *mutex, int timeout_ms)
break; break;
} }
mutex->cond_waiting++;
if (timeout_ms) { if (timeout_ms) {
int ret; int ret;
struct timespec timeout_rel; 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); ret = native_cond_timedwait(&mutex->cond, &mutex->lock, &timeout);
if (ret == ETIMEDOUT) { if (ret == ETIMEDOUT) {
interrupted = 2; interrupted = 2;
mutex->cond_waiting--;
break; break;
} }
} }
else { else {
mutex->cond_waiting++;
native_cond_wait(&mutex->cond, &mutex->lock); native_cond_wait(&mutex->cond, &mutex->lock);
mutex->cond_notified--;
} }
mutex->cond_notified--;
if (RUBY_VM_INTERRUPTED(th)) { if (RUBY_VM_INTERRUPTED(th)) {
interrupted = 1; interrupted = 1;