More general check for semaphore

This commit is contained in:
Alexandre Alapetite 2017-06-28 22:38:22 +02:00
parent 4eaa6b94a6
commit 329ab7d153

View file

@ -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();