Mutex and Semaphore

Hello,
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.
Peter.Kramer [ Di, 10 Januar 2006 11:24 ] [ ID #1135902 ]
Perl » alt.perl » Mutex and Semaphore

Vorheriges Thema: Help with files
Nächstes Thema: net::rawip source code question