/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 */
package fr.gouv.culture.util.apache.avalon.excalibur.concurrent;

import fr.gouv.culture.util.apache.cocoon.xml.SynchronizationException;


/**
 *
 * @version CVS $Revision: 1.1 $ $Date: 2007/09/19 15:51:11 $
 * @since 4.0
 */

public class Mutex
        extends Semaphore {
    public Mutex() {
        super(1);
    }

    public boolean isAcquired() throws SynchronizationException {
        if (super.getTokens() == 1)
            throw new SynchronizationException();//not acquired  yet
        return true;//zero tokens means the object the sync object was acquired
    }
    
    public boolean acquired(){
        if (super.getTokens() == 1)
            return false;//not acquired  yet
        return true;//zero tokens means the object the sync object was acquired
    }

}


