Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'modify': 0.07; 'tries': 0.07; 'app,': 0.09; 'mind,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'solution,': 0.09; 'python': 0.11; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'threads.': 0.16; 'prevent': 0.16; 'file,': 0.19; 'written': 0.21; 'bytes': 0.24; 'url:home': 0.24; 'file.': 0.24; 'header:X -Complaints-To:1': 0.27; "i'm": 0.30; 'code': 0.31; 'file': 0.32; 'but': 0.35; 'there': 0.35; '+0200,': 0.36; 'application': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'truly': 0.60; 'mar': 0.68; '2015': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Lockfile hanling Date: Tue, 31 Mar 2015 19:44:46 -0400 Organization: IISS Elusive Unicorn References: <20150331145012.GA4460@arxnet.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: adsl-108-79-216-138.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427845511 news.xs4all.nl 2946 [2001:888:2000:d::a6]:56797 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88408 On Tue, 31 Mar 2015 16:50:12 +0200, Ervin Hegedüs declaimed the following: >Hello, > >there is an app, written in Python, which stores few bytes of >datas in a single file. The application uses threads. Every >thread can modify the file, but only one at a time. I'm using a >lock file to prevent the multiple access. > If there is only one instance of the application, and it is truly using threads... The solution, to my mind, is to use a Python lock object around the code that tries to modify the file. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/