diff options
-rw-r--r-- | thread_sync.c | 8 | ||||
-rw-r--r-- | version.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/thread_sync.c b/thread_sync.c index ef0bbf3af3..bd51328e52 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -272,6 +272,7 @@ rb_mutex_lock(VALUE self) list_add_tail(&mutex->waitq, &w.node); native_sleep(th, timeout); /* release GVL */ list_del(&w.node); + if (!mutex->th) { mutex->th = th; } @@ -287,10 +288,13 @@ rb_mutex_lock(VALUE self) th->status = prev_status; } th->vm->sleeper--; - if (mutex->th == th) mutex_locked(th, self); - RUBY_VM_CHECK_INTS_BLOCKING(th->ec); + RUBY_VM_CHECK_INTS_BLOCKING(th->ec); /* may release mutex */ + if (!mutex->th) { + mutex->th = th; + mutex_locked(th, self); + } } } return self; @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.5.2" #define RUBY_RELEASE_DATE "2018-10-11" -#define RUBY_PATCHLEVEL 98 +#define RUBY_PATCHLEVEL 99 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 10 |