]> granicus.if.org Git - php/commitdiff
Fix for nowait.phpt failing intermittently
authorMitch Hagstrand <mhagstrand@gmail.com>
Mon, 2 Jan 2017 15:49:32 +0000 (07:49 -0800)
committerJoe Watkins <krakjoe@php.net>
Mon, 2 Jan 2017 16:45:52 +0000 (16:45 +0000)
The parent process was releasing the child semaphore
after the child process continued execution. Now
the child semaphore is released before the child
process continues execution.

ext/sysvsem/tests/nowait.phpt

index 8557ce33ee3a614c7bdd03749d1e9639391bf21d..23f0dfc1659a5a35d338f0deb0a3df110dcb23db 100644 (file)
@@ -67,12 +67,16 @@ if ($pid) {
                exit;
        }
 
+       /* Release the child semahpore before releasing
+          the releasing the parent semaphore and letting
+          the child continue execution */
+       sem_release($c_sem_id);
+
        echo "P: releasing semaphore $p_sem_id.\n";
        if (!sem_release($p_sem_id)) {
                echo "P: failed to release semaphore\n";
        }
 
-       sem_release($c_sem_id);
        $status = null;
        pcntl_waitpid($pid, $status);