Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.068 X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:files': 0.09; 'suggestions:': 0.09; 'cc:addr :python-list': 0.10; 'benjamin': 0.16; 'worst': 0.16; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'locking': 0.29; 'case,': 0.29; "i'm": 0.29; 'file': 0.32; 'received:google.com': 0.34; 'thanks': 0.34; 'open': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'test': 0.36; 'should': 0.36; 'possible': 0.37; 'two': 0.37; 'why': 0.37; 'received:209': 0.37; 'far': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'shows': 0.38; 'header:Received:5': 0.40; 'end': 0.40; 'skip:u 10': 0.60; 'different': 0.63; 'here': 0.65; 'oscar': 0.84; 'try,': 0.84; 'processes,': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=sso8ykrDOSKhQxmcPp2b09Q8p7Z+M5oAax6YnSwksPk=; b=jtDhlqhvC0fpJb0SNkGKHqsw6vP5r9OA+xnu2PqVqR84x2OWIRW0S1IXm4IHvE8xoB t12nO5IwXLcxHoSb4pKNE83HuzWlCMmeue/kMAFjSczD6dw4qud31Z1Fo5WrTH/CrreE 22ycvV8ZrDT60jK1uJ8uH0tJfhzWgy7wzVc1xrv2kRCq+KZthQf02ZI+xsAlFxvnF2Qd t1qmMRRrwX6XvPHh+/zVgtgVCi9P2Ge3Ueeb6THXpd90GgmQDVMaj9jhtMYpO/ZIwNIX QkjoJnR8sacP75cgL1cI/bq/+weo09VfgImZodNvYhY8kLn5WCaiPGnQ3kRHzPOp8jJo fiew== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 18 Oct 2012 16:08:08 +0100 Subject: Re: locking files on Linux From: andrea crotti To: Oscar Benjamin Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350572891 news.xs4all.nl 6983 [2001:888:2000:d::a6]:55576 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31650 2012/10/18 Oscar Benjamin : > > Why not come up with a test that actually shows you if it works? Here > are two suggestions: > > 1) Use time.sleep() so that you know how long the lock is held for. > 2) Write different data into the file from each process and see what > you end up with. > Ok thanks I will try, but I thought that what I did was the worst possible case, because I'm opening and writing on the same file from two different processes, locking the file with LOCK_EX. It should not open it at all as far as I understood...