X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Futil%2FSemaphore.java;h=0537ce82f999c0ba0098fd30bab2721205aa7b8e;hb=1f80106afa0f0eb6f12544c75304f2084aca6499;hp=ad8376fb735f1a437a0fc815f84552be7d41ff00;hpb=3a85dab61cef1346315ca40d3004f8772815127f;p=org.ibex.util.git diff --git a/src/org/ibex/util/Semaphore.java b/src/org/ibex/util/Semaphore.java index ad8376f..0537ce8 100644 --- a/src/org/ibex/util/Semaphore.java +++ b/src/org/ibex/util/Semaphore.java @@ -1,9 +1,6 @@ -// 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") +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the Apache Public Source License 2.0 ("the License"). +// You may not use this file except in compliance with the License. package org.ibex.util; @@ -12,9 +9,13 @@ public class Semaphore { private int val = 0; + public synchronized void dec() { + val--; + } + /** Decrement the counter, blocking if zero. */ public synchronized void block() { - while(val == 0) { + while(val <= 0) { try { wait(); } catch (InterruptedException e) {