diff options
Diffstat (limited to 'thread_sync.c')
-rw-r--r-- | thread_sync.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/thread_sync.c b/thread_sync.c index 2bcf59137e..2f43896cfb 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -327,6 +327,10 @@ do_mutex_lock(VALUE self, int interruptible_p) } } else { + if (!th->vm->thread_ignore_deadlock && rb_fiber_threadptr(mutex->fiber) == th) { + rb_raise(rb_eThreadError, "deadlock; lock already owned by another fiber belonging to the same thread"); + } + enum rb_thread_status prev_status = th->status; rb_hrtime_t *timeout = 0; rb_hrtime_t rel = rb_msec2hrtime(100); |