On Mon, Mar 18, 2002 at 03:57:55AM -0500, Mark-Jason Dominus wrote:
>
> Michael The Schwern <[EMAIL PROTECTED]> says:
> > Use alarm and skip the test if $Config{d_alarm} is false (see
> > t/op/alarm.t for an example). If you think the infinite loop is due
> > to a programming glitch, as opposed
On Mon, Mar 18, 2002 at 02:14:23PM -0700, Sean M. Burke wrote:
> At 03:26 2002-03-18 -0500, Michael G Schwern wrote:
> >[...]Use alarm and skip the test if $Config{d_alarm} is false (see
> >t/op/alarm.t for an example). If you think the infinite loop is due
> >to a programming glitch, as opposed
At 03:26 2002-03-18 -0500, Michael G Schwern wrote:
>[...]Use alarm and skip the test if $Config{d_alarm} is false (see
>t/op/alarm.t for an example). If you think the infinite loop is due
>to a programming glitch, as opposed to a cross-platform issue, this
>will be enough.
Ya know, for a while
On Mon, Mar 18, 2002 at 11:14:59AM -0500, Mark-Jason Dominus wrote:
> > I just thought of a clever way to do it without alarm!
>
> So clever, it doesn't work!
>
> > lock_file($foo);
> > open(FH, $foo);
> > ok( !flock(FH, LOCK_NB | LOCK_EX) );
>
> Seriously, on most unix systems, t
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)');
>>
> I just thought of a clever way to do it without alarm!
So clever, it doesn't work!
> lock_file($foo);
> open(FH, $foo);
> ok( !flock(FH, LOCK_NB | LOCK_EX) );
Seriously, on most unix systems, the following:
flock(FH, LOCK_EX);
flock(FH, LOCK_EX|LOCK_NB) or die;
On Mon, Mar 18, 2002 at 03:57:55AM -0500, Mark-Jason Dominus wrote:
> Actually that reminds me of another puzzle I have. My module provides
> an interface to 'flock'. 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 f
Michael The Schwern <[EMAIL PROTECTED]> says:
> Use alarm and skip the test if $Config{d_alarm} is false (see
> t/op/alarm.t for an example). If you think the infinite loop is due
> to a programming glitch, as opposed to a cross-platform issue, this
> will be enough.
Thanks very much!
> The on
On Mon, Mar 18, 2002 at 02:45:33AM -0500, Mark-Jason Dominus wrote:
>
> I've just found a bug in my module. The bug results in an
> inappropriate infinite loop.
>
> Before I fix the bug, I want to write up a test case.
>
> I can reproduce the bug OK, but if I put that code into the module
> te