From: Alexandre Alapetite Date: Wed, 28 Jun 2017 20:38:22 +0000 (+0200) Subject: More general check for semaphore X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=329ab7d1533e2ae6f81249de036866fca6a2b964;p=friendica.git More general check for semaphore --- diff --git a/src/Util/Lock.php b/src/Util/Lock.php index 3988294b0f..ca75b0d666 100644 --- a/src/Util/Lock.php +++ b/src/Util/Lock.php @@ -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();