X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2Futil%2FQueue.java;h=8da10d4d8945abb522b51bfe7a260804a8a1f453;hb=de378041d5ca2aca1a2b5a31ef15ae90a86c977f;hp=a6f0a929b9a8605ac1e759ea6fda936dae0ef042;hpb=5823567836a2cdf26e4a6832edacac9864188e67;p=org.ibex.core.git diff --git a/src/org/xwt/util/Queue.java b/src/org/xwt/util/Queue.java index a6f0a92..8da10d4 100644 --- a/src/org/xwt/util/Queue.java +++ b/src/org/xwt/util/Queue.java @@ -1,4 +1,10 @@ -// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL] +// Copyright (C) 2003 Adam Megacz all rights reserved. +// +// You may modify, copy, and redistribute this code under the terms of +// the GNU Library Public License version 2.1, with the exception of +// the portion of clause 6a after the semicolon (aka the "obnoxious +// relink clause") + package org.xwt.util; /** A simple synchronized queue, implemented as an array */ @@ -64,17 +70,11 @@ public class Queue { block is true and the queue is empty. */ public synchronized Object remove(boolean block) { - while (size == 0) { - if (!block) return null; - try { - wait(); - } catch (InterruptedException e) { - } catch (Exception e) { - if (Log.on) Log.log(this, "exception in Queue.wait(); this should never happen"); - if (Log.on) Log.log(this, e); - } + while (size == 0 && block) { + try { wait(); } catch (InterruptedException e) { } } + if (!block && size == 0) return null; Object ret = vec[first]; first++; size--;