mirror of
https://github.com/twisterarmy/twister-rss-bot.git
synced 2025-02-07 04:34:25 +00:00
prevent multi-thread execution
This commit is contained in:
parent
932b5c76a6
commit
fbe17d0bc3
@ -10,6 +10,21 @@ $config = json_decode(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Prevent multi-thread execution
|
||||||
|
$semaphore = sem_get(
|
||||||
|
crc32(
|
||||||
|
__DIR__ . '.twister.rss.bot'
|
||||||
|
),
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
if (false === sem_acquire($semaphore, true))
|
||||||
|
{
|
||||||
|
exit(
|
||||||
|
_('Process locked by another thread') . PHP_EOL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Connect twister
|
// Connect twister
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user