delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
In-Reply-To: | <20090312221723.GA9322@calimero.vinschen.de> |
References: | <9e3fd2c80903120740u5fa06d62t372cd67212fad1e AT mail DOT gmail DOT com> <20090312155236 DOT GX9322 AT calimero DOT vinschen DOT de> <9e3fd2c80903120944h5aebc094y7e461eee580e4eeb AT mail DOT gmail DOT com> <20090312221723 DOT GA9322 AT calimero DOT vinschen DOT de> |
Date: | Fri, 13 Mar 2009 08:36:03 +0100 |
Message-ID: | <9e3fd2c80903130036v7898622fuca6f83d8c0080837@mail.gmail.com> |
Subject: | Re: Problem getting flock with timeout to work |
From: | Robert Klemme <shortcutter AT googlemail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
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 |
Corinna, thanks for your feedback! 2009/3/12 Corinna Vinschen <corinna-cygwin AT cygwin DOT com>: > On Mar 12 17:44, Robert Klemme wrote: >> The second flock does not start the command as I expect it to be. >> >> I am referring to the man page of flock which says this about option -w: >> >> Fail =A0(with an exit code of 1) if the lock cannot be acquired within >> seconds seconds. =A0Decimal fractional values are allowed. >> >> So, since the second flock obviously cannot obtain the lock in time, I >> would have expected it to fail and not execute the command given. >> This is at least a documentation issue as flock's behavior and >> documentation do not match IMHO. > > This scenario (your first testcase) works fine with Cygwin 1.7 with my > fix from a couple of hours ago. =A0I missed the fact that BSD flock lock > semantic allows to set both lock types (LOCK_SH/LOCK_EX) regardless of > the read/write mode in which the file has been opened, in contrast > to POSIX lock semantic. =A0That's fixed now and other than that glitch, > it worked. Hey, that's good news! > However... > Cygwin won't be able to support the scenario from your second testcase > for the time being. =A0The reason is that in this scenario > > =A0( > =A0 =A0flock -s 200 > =A0 =A0... > =A0) 200> lockfile > > the lock will end when the flock process exits. =A0The lock can only > persist as long as the process which created the lock, or any of the > child applications which inherited the file descriptor, still runs. =A0We > can't maintain a global file descriptor table with lock information like > the OS or what a master process could do if Cygwin would be designed so. Thank you for the explanation! > I know that's bad news, it certainly is for me since I thought I had > implemented flock with full BSD semantics, but we just can't do that > for now. For me this is good enough - I find the variant "flock -c" better anyway. := -) Thank you for looking into this! Sorry for the intermediate confusion about your "wrong" Linux. Kind regards robert -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |