<?php

    $key = ftok ( __FILE__, "q" );
    $semaphore = sem_get ( $key, 1 );

    if ( sem_acquire ( $semaphore, 1 ) !== false )
    {
        while ( true )
        {
            sleep ( 1 );
            echo "proc\n";
        }
        sem_release ( $semaphore );
    }
    else
    {
        echo "Another process is running\n";
    }

?>

Categories: PHP language

5 Comments

altogel · 23/01/2025 at 04:36

… [Trackback]

[…] Find More here on that Topic: durukanbal.com/2021/02/26/php-another-process-is-running/ […]

som777 · 25/01/2025 at 11:57

… [Trackback]

[…] There you can find 49905 additional Information on that Topic: durukanbal.com/2021/02/26/php-another-process-is-running/ […]

HuaHin Boxing Stadium · 20/02/2025 at 00:35

… [Trackback]

[…] Find More on on that Topic: durukanbal.com/2021/02/26/php-another-process-is-running/ […]

here · 21/02/2025 at 07:35

… [Trackback]

[…] Information on that Topic: durukanbal.com/2021/02/26/php-another-process-is-running/ […]

slot99 · 13/03/2025 at 10:09

… [Trackback]

[…] Read More here to that Topic: durukanbal.com/2021/02/26/php-another-process-is-running/ […]

Leave a Reply

Avatar placeholder