From: Philipp Holzer Date: Mon, 26 Aug 2019 21:55:54 +0000 (+0200) Subject: Some code hardenings for semaphore locking X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=de7c026590576e6215abeee5d762680355f61dd1;p=friendica.git Some code hardenings for semaphore locking --- diff --git a/src/Core/Lock/SemaphoreLock.php b/src/Core/Lock/SemaphoreLock.php index d5153d432e..adfab5fc0e 100644 --- a/src/Core/Lock/SemaphoreLock.php +++ b/src/Core/Lock/SemaphoreLock.php @@ -39,8 +39,8 @@ class SemaphoreLock extends Lock public function acquireLock($key, $timeout = 120, $ttl = Cache\Cache::FIVE_MINUTES) { self::$semaphore[$key] = sem_get(self::semaphoreKey($key)); - if (self::$semaphore[$key]) { - if (sem_acquire(self::$semaphore[$key], ($timeout == 0))) { + if (!empty(self::$semaphore[$key])) { + if ((bool)sem_acquire(self::$semaphore[$key], ($timeout === 0))) { $this->markAcquire($key); return true; }