diff options
Diffstat (limited to 'thread.c')
-rw-r--r-- | thread.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; |