fix semaphore construction

This commit is contained in:
kvazar-network 2025-04-21 16:44:49 +03:00
parent f6cb2a4191
commit f2a0c3a94e

View File

@ -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))
{