delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/12/10:53:01

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 12 Mar 2009 16:52:36 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Problem getting flock with timeout to work
Message-ID: <20090312155236.GX9322@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <9e3fd2c80903120740u5fa06d62t372cd67212fad1e AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <9e3fd2c80903120740u5fa06d62t372cd67212fad1e@mail.gmail.com>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019