Mutex and Semaphore
am 10.01.2006 11:24:17 von Peter.KramerHello,
I'm try to use Win32::Mutex and Semaphore to build a mutex object when
opening a file but no mutex or semaphore seems to work.
I'm using Perl 584 or later.
What I'm doing is fork several times and open the same file in each child
and delete it after reading.
if ($pid=fork())
{
wait;
}
else
{
loop
mutex stuff here;
open file;
delete file;
do stuff;
sleep;
}
Win32::Mutex; and Semaphore alsways returns a 0, release alswas a 1;
Has anyone a proper working example how to use a mutex on opening a file. I
also tried flock, but it seems to be non atomar.
Thanks
P.