<?php
/**
 * Created by JetBrains PhpStorm.
 * User: shenlixia01
 * Date: 11-10-17
 * Time: 下午7:53
 * To change this template use File | Settings | File Templates.
 */

class Semaphore
{
    private $mutex;

    public function _construct( $key )
    {
        $this->mutex = sem_get( $key , 1 );
    }

    public  function  remove(){
        sem_remove($this->mutex);
    }

    public function start(){
        sem_acquire($this->mutex);
    }
    public  function  end(){
        sem_release($this->mutex);
    }
}

?>