Back to index

php5  5.3.10
Functions | Variables
test-pcntl.php File Reference

Go to the source code of this file.

Functions

 alarm_handle ($signal)
 usr1_handle ($signal)

Variables

print This test will
demonstrate a fork followed by
ipc via signals 
n
 $pid = pcntl_fork()

Function Documentation

alarm_handle ( signal)

Definition at line 6 of file test-pcntl.php.

                              {
        if ($signal==SIGALRM) print "Child: Caught SIGALRM!!!\n";
}
usr1_handle ( signal)

Definition at line 10 of file test-pcntl.php.

                             {
       if ($signal==SIGUSR1) print "Child: Caught SIGUSR1!!!\n";
}

print "This test will demonstrate a fork followed by ipc via signals.\n";

$pid=pcntl_fork();
if ($pid==0) {
       pcntl_signal(SIGUSR1, "usr1_handle");
       pcntl_signal(SIGALRM, "alarm_handle");
       print "Child: Waiting for alarm.....\n";
       sleep(100);
       print "Child: Waiting for usr1......\n";
       sleep(100);
       print "Child: Resetting Alarm handler to Ignore....\n";
       pcntl_signal(SIGALRM, SIG_IGN);
       print "Child: sleeping for 10 seconds....\n";
       sleep(10);
       print "Done\n";
} else {

Variable Documentation

$pid = pcntl_fork()

Definition at line 16 of file test-pcntl.php.

print This test will demonstrate a fork followed by ipc via signals n

Definition at line 14 of file test-pcntl.php.