This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Problem getting flock with timeout to work
On Mar 12 15:40, Robert Klemme wrote:
> Hi,
>
> I searched the archives but could not find any related issue. My
> problem is this: I use flock with a timeout but apparently the timeout
> does not work, i.e. flock waits longer than specified. Script is
> attached. Output is here:
>
> This is ok, timeout is longer than needed:
>
> 15:34:27 tmp$ ./fl-test-2.sh
> CYGWIN_NT-5.1 padrklemme1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
> -rw-r--r-- 1 RKlemme Domain Users 0 Mar 12 15:34 lock
> timeout 10
> started 1
> 3672 Thu Mar 12 15:34:32 WEST 2009
> started 2
> 3672 Thu Mar 12 15:34:33 WEST 2009
> waiting...
> 3672 Thu Mar 12 15:34:34 WEST 2009
> 3672 Thu Mar 12 15:34:35 WEST 2009
> 3672 Thu Mar 12 15:34:36 WEST 2009
> 2884 Thu Mar 12 15:34:37 WEST 2009
> 2884 Thu Mar 12 15:34:39 WEST 2009
> 2884 Thu Mar 12 15:34:40 WEST 2009
> 2884 Thu Mar 12 15:34:41 WEST 2009
> 2884 Thu Mar 12 15:34:42 WEST 2009
> done
10 seconds
> This looks wrong, timeout is much shorter than what the process takes
> and should abort:
>
> 15:34:43 tmp$ ./fl-test-2.sh 2
> CYGWIN_NT-5.1 padrklemme1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
> -rw-r--r-- 1 RKlemme Domain Users 0 Mar 12 15:34 lock
> timeout 2
> started 1
> 2444 Thu Mar 12 15:34:45 WEST 2009
> started 2
> 2444 Thu Mar 12 15:34:47 WEST 2009
> waiting...
> 2444 Thu Mar 12 15:34:48 WEST 2009
> 2444 Thu Mar 12 15:34:49 WEST 2009
> 2444 Thu Mar 12 15:34:50 WEST 2009
> 4064 Thu Mar 12 15:34:51 WEST 2009
> 4064 Thu Mar 12 15:34:52 WEST 2009
> 4064 Thu Mar 12 15:34:53 WEST 2009
> 4064 Thu Mar 12 15:34:55 WEST 2009
> 4064 Thu Mar 12 15:34:56 WEST 2009
> done
11 seconds
> Any ideas? Am I doing something wrong?
On second thought, maybe I don't understand what you're expecting.
Running the testcase on a Linux box I get this:
Linux calimero 2.6.[etc]
-rw-r--r-- 1 corinna vinschen 0 Mar 12 16:48 lock
timeout 10
started 1
3644 Thu Mar 12 16:48:48 CET 2009
started 2
3644 Thu Mar 12 16:48:49 CET 2009
waiting...
3644 Thu Mar 12 16:48:50 CET 2009
3644 Thu Mar 12 16:48:51 CET 2009
3644 Thu Mar 12 16:48:52 CET 2009
3662 Thu Mar 12 16:48:53 CET 2009
3662 Thu Mar 12 16:48:54 CET 2009
3662 Thu Mar 12 16:48:55 CET 2009
3662 Thu Mar 12 16:48:56 CET 2009
3662 Thu Mar 12 16:48:57 CET 2009
done
9 seconds
I don't see that this is different in the sense of "more correct" than
on Cygwin.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/