Mark-Jason Dominus <[EMAIL PROTECTED]> writes:
>
>> So here's the other way.  We cause a deadlock using another process
>> which kills itself after a certain amount of time.
>>
>>     my $start = time;
>>     lock_file($foo);
>>     system($^X, '-e', 'use Whatever;  alarm 5;  lock_file($foo)');
>>     cmp_ok( time, '>', $start + 3,     'Locking works' );
>>
>> again, these all rely on alarm().
>
>This on also relies on system creating a new process.  I wasn't sure
>what this would do on Win32, VMS, OS390, etc.  Hence my original
>question:

FWIW system() does create a new process on Win32, but fork() does not
(in only creates a new thread). I have no idea if flock-faking stuff
on Win32 allows recursive locks by different threads of the same process ...

>
>>> What is an easy way to check that the file is actually being locked?
>>> I put off writing the tests because i did not want to fork.
>
>Sorry to be so elliptical.  What I should have said was that I can
>think of lots of ways to do it but they all involve starting a new
>process, and I'm reluctant to start a new prcoess unless I have to,
>because I have no idea what it does on Weird Platform X.

And quite right too ;-)


--
Nick Ing-Simmons
http://www.ni-s.u-net.com/



Reply via email to