deadlock on unshelve

This commit is contained in:
irengrig
2011-12-29 00:29:42 +04:00
parent d6b392c5b3
commit 0d12ae3f14
2 changed files with 10 additions and 12 deletions
@@ -245,11 +245,11 @@ abstract class GeneralRunner implements ContinuationContext {
@Nullable
protected TaskDescriptor getNextMatching() {
while (true) {
if (myTriggerSuspend) {
return null;
}
synchronized (myQueueLock) {
if (myQueue.isEmpty()) return null;
if (myTriggerSuspend) {
return null;
}
TaskDescriptor current = myQueue.remove(0);
// check if some tasks were scheduled after disaster was thrown, anyway, they should also be checked for cure
if (! current.isHaveMagicCure()) {
@@ -68,16 +68,14 @@ public class SameProgressRunner extends GeneralRunner {
final TaskDescriptor current = getNextMatching();
if (current == null) {
synchronized (myQueueLock) {
if (myTriggerSuspend) {
mySemaphore.down();
while (myTriggerSuspend) {
mySemaphore.waitFor(500);
}
continue;
} else {
return;
if (myTriggerSuspend) {
mySemaphore.down();
while (myTriggerSuspend) {
mySemaphore.waitFor(500);
}
continue;
} else {
return;
}
}