From 9c9eb86b2feb6fbfe336fe40a1cf6962d42b606c Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 16 Jul 2009 11:51:35 -0600 Subject: [PATCH] fix deadlock in allocate3 when another thread wants to enter the exclusive state --- src/machine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/machine.cpp b/src/machine.cpp index c0ee2be304..2fb5fbb1cc 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2055,6 +2055,10 @@ allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type, // another thread wants to enter the exclusive state, either for a // collection or some other reason. We give it a chance here. ENTER(t, Thread::IdleState); + + while (t->m->exclusive) { + t->m->stateLock->wait(t->systemThread, 0); + } } switch (type) {