X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Futil%2FQueue.java;h=8da10d4d8945abb522b51bfe7a260804a8a1f453;hb=de378041d5ca2aca1a2b5a31ef15ae90a86c977f;hp=7d74b9c772d1681dee0bf8b17525761d6cf3e432;hpb=2b2b24b52422cf388ef6170090487eb60ec06a4e;p=org.ibex.core.git diff --git a/src/org/xwt/util/Queue.java b/src/org/xwt/util/Queue.java index 7d74b9c..8da10d4 100644 --- a/src/org/xwt/util/Queue.java +++ b/src/org/xwt/util/Queue.java @@ -70,9 +70,11 @@ public class Queue { block is true and the queue is empty. */ public synchronized Object remove(boolean block) { - try { wait(); } catch (InterruptedException e) { } - if (!block) return null; + while (size == 0 && block) { + try { wait(); } catch (InterruptedException e) { } + } + if (!block && size == 0) return null; Object ret = vec[first]; first++; size--;