Why not work POSIX::RT:Semaphore

D

Dima

This is my simple code

#!/usr/local/bin/perl
use threads;
use threads::shared;
use POSIX::RT::Semaphore;

$sem = POSIX::RT::Semaphore->init(0, 0);

my $pid = fork;
if ( $pid == 0 )
{
$sem->wait;
print "CODE2\n";
exit;
}

print "CODE1\n";
$sem->post;


Why I see only CODE1???
Why after post in parent process semaphore value in child process was't changed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top