Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.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.127 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.75; '*S*': 0.01; 'implements': 0.09; 'cc:addr:python-list': 0.11; 'all?': 0.16; 'commonly,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'resource,': 0.16; 'roy': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'written': 0.21; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; 'nearly': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'file': 0.32; 'quite': 0.32; 'but': 0.35; 'received:google.com': 0.35; "didn't": 0.36; 'whatever': 0.38; 'resource': 0.38; 'anything': 0.39; 'most': 0.60; 'tell': 0.60; 'offer': 0.62; 'needing': 0.65; 'smith': 0.68; 'article': 0.77; 'protect': 0.79; 'advisory': 0.84; 'all!': 0.84; 'all;': 0.84; 'locked': 0.84; 'pirates': 0.84; 'subject:system': 0.84; 'to:none': 0.92 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:cc :content-type; bh=iDOiNwSVOGpWgkFCBiz01+S0CSjvYHOjD9nkTKq785M=; b=STfP3aRKvuUxtEmCS2dnOPPfCZNZMk9vQ0USjTEvEBR5Rv4cAxL7U9kzhSEFqOhgPi VfQSnu0bBbz0Oxf+yUjl/OpLyHIO4V6UCWugGCNpGB7EGQoedkIcuoLIweys9aJoZ7l3 qRfs6hKL1YsEEAKHrpzR153F8JYfWIrgOkRjDwZzh/fNGdL8X0ds70UsBt+Sesd1vVZd gZinGC5FKT3Uhmbl/ApQWzdtZtbTc4enAWrfsg9/hruC4VyqvzRwYuOyR1w6FK9YGyjY 8DgjK8ZTmtR746/3GLIg+gfT53B3q/mf6Q6+UPMLaJ1mfHWVxxpzU7agskSLuBah9CPg dRkw== MIME-Version: 1.0 X-Received: by 10.68.178.66 with SMTP id cw2mr33376703pbc.89.1391983758412; Sun, 09 Feb 2014 14:09:18 -0800 (PST) In-Reply-To: References: Date: Mon, 10 Feb 2014 09:09:18 +1100 Subject: Re: system wide mutex From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391983767 news.xs4all.nl 2978 [2001:888:2000:d::a6]:47058 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65783 On Mon, Feb 10, 2014 at 1:45 AM, Roy Smith wrote: > In article , > Skip Montanaro wrote: > >> As the author of lockfile, I can tell you it only implements advisory >> locking. All programs needing to access the locked resources must >> cooperate. > > This is true of all mutexes, no? > Not quite all; mandatory locks actually prevent other access. But they require support from whatever makes the resource available - most commonly, the file system - where cooperative locking doesn't. I've written a number of cooperative locking systems in the past (eg to protect a network resource, when the mounted file system didn't offer the sort of locking I needed), and they're usually the way to go when there's anything complicated going on. What, all mutexes? Yes, all mutexes! What, all? Well.... nearly all! -- with apologies to WS Gilbert, HMS Pinafore, and the Pirates of Penzance ChrisA