$semaphore = sem_get(ftok(__FILE__, "a")); $mutex = new SemaphoreMutex($semaphore);
public function __construct($semaphore) { if (!is_resource($semaphore)) { throw new \InvalidArgumentException("The semaphore id is not a valid resource."); } $this->semaphore = $semaphore; }