More general check for semaphore
This commit is contained in:
parent
4eaa6b94a6
commit
329ab7d153
1 changed files with 8 additions and 2 deletions
|
@ -156,8 +156,14 @@ class Lock {
|
|||
* @param string $fn_name Name of the lock
|
||||
*/
|
||||
public static function remove($fn_name) {
|
||||
if (function_exists('sem_get') && self::$semaphore[$fn_name]) {
|
||||
return @sem_release(self::$semaphore[$fn_name]);
|
||||
if (function_exists('sem_get')) {
|
||||
if (empty(self::$semaphore[$fn_name])) {
|
||||
return false;
|
||||
} else {
|
||||
$rid = self::$semaphore[$fn_name];
|
||||
self::$semaphore[$fn_name] = 0;
|
||||
return @sem_release($rid);
|
||||
}
|
||||
}
|
||||
|
||||
$memcache = self::connectMemcache();
|
||||
|
|
Loading…
Reference in a new issue