Project

General

Profile

Bug #6278 ยป deadlock_detection_fix.patch

thedarkone (Vit Z), 08/04/2012 10:53 PM

View differences:

thread.c
th->priority = GET_THREAD()->priority;
th->thgroup = GET_THREAD()->thgroup;
th->spinlock_waiting_gvl = 0;
native_mutex_initialize(&th->interrupt_lock);
if (GET_VM()->event_hooks != NULL)
th->event_flags |= RUBY_EVENT_VM;
......
}
GVL_UNLOCK_BEGIN();
interrupted = lock_func(th, mutex, timeout_ms);
th->spinlock_waiting_gvl = 1;
native_mutex_unlock(&mutex->lock);
GVL_UNLOCK_END();
th->spinlock_waiting_gvl = 0;
reset_unblock_function(th, &oldubf);
th->locking_mutex = Qfalse;
......
GetMutexPtr(th->locking_mutex, mutex);
native_mutex_lock(&mutex->lock);
if (mutex->th == th || (!mutex->th && mutex->cond_waiting)) {
if (mutex->th == th || (!mutex->th && (mutex->cond_waiting || th->spinlock_waiting_gvl))) {
*found = 1;
}
native_mutex_unlock(&mutex->lock);
vm_core.h
rb_thread_lock_t interrupt_lock;
struct rb_unblock_callback unblock;
VALUE locking_mutex;
int spinlock_waiting_gvl;
struct rb_mutex_struct *keeping_mutexes;
struct rb_vm_tag *tag;
    (1-1/1)