Skip to content

Commit

Permalink
fix exception throw when locking/unlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
Bashar Qassis authored Oct 10, 2017
1 parent d0fbcb2 commit 077db26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Simple/SHM/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function lock()
{
if (function_exists('sem_get')) {
$this->lockHandler = PHP_VERSION < 4.3 ? sem_get($this->id, 1, 0600) : sem_get($this->id, 1, 0600, 1);
if ( ! sem_acquire($this->lockHandler)) throw 'sem_acquire faild';
if ( ! sem_acquire($this->lockHandler)) throw new \Exception('sem_acquire failed', 400);
} else {
$this->lockHandler = fopen('/tmp/sm_'.md5($this->id), 'w');
flock($this->lockHandler, LOCK_EX);
Expand All @@ -212,7 +212,7 @@ public function lock()
public function unlock()
{
if (function_exists('sem_get')) {
if ( ! sem_release($this->lockHandler)) throw 'sem_release faild';
if ( ! sem_release($this->lockHandler)) throw new \Exception('sem_release failed', 400);
} else {
fclose($this->lockHandler);
}
Expand Down

0 comments on commit 077db26

Please sign in to comment.