From f2a0c3a94e41199ed96f352bdd7b57c6c5edcc35 Mon Sep 17 00:00:00 2001 From: kvazar-network Date: Mon, 21 Apr 2025 16:44:49 +0300 Subject: [PATCH] fix semaphore construction --- src/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.php b/src/index.php index 8d73697..cb9878e 100644 --- a/src/index.php +++ b/src/index.php @@ -12,6 +12,11 @@ define('CONFIG', __DIR__ . '/../config.json'); // Load composer dependencies require_once __DIR__ . '/../vendor/autoload.php'; +// Prevent multi-thread execution +$semaphore = sem_get( + crc32(__FILE__), 1 +); + if (false === sem_acquire($semaphore, true)) { exit( @@ -19,11 +24,6 @@ if (false === sem_acquire($semaphore, true)) ); } -// Prevent multi-thread execution -$semaphore = sem_get( - crc32(__FILE__), 1 -); - // Init config if (!file_exists(CONFIG)) {