Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.084 X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; 'subject:Python': 0.06; 'python': 0.11; 'c-level': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:GIL': 0.16; 'wrote:': 0.18; 'example': 0.22; '31,': 0.24; 'instance,': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'consequence': 0.31; 'releasing': 0.31; 'fri,': 0.33; 'proceed': 0.33; "can't": 0.35; 'something': 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'hi,': 0.36; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'anything': 0.39; 'explain': 0.39; 'to:addr:python.org': 0.39; 'release': 0.40; 'how': 0.40; 'read': 0.60; 'till': 0.61; 'simple': 0.61; 'ana': 0.84; 'reading,': 0.84; '2013': 0.98 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 :content-type; bh=1u46QJ4E+b3t4gwNCkPgs6WvTAsGYYYkZwnTgjKL1qg=; b=mxOp8VzyE9jqPZV4OQO0+LAWFm3ThGtjtlQMAbF9cq59xj6lHhNhtZXzytfEsuJKJt hFRYNsfKxTEpv2gRGbfbPS6Cahh4hqeWkm8S0/+l/dpQuU7GV5wl30+sjdVH3uRyDk0C E80MkF/ec1zsQGNPfBS0EMugUrQYYaJhlXNMintjPJcOQjn+4jMxMrMSIWOxb3UkqCvK om4RqFieYLJ7PBo9aRnM5zMXSWNC9hndWqI7kP9mB0rP2MZhUSr3H24+wPdYK299DIbb u/0McQRgbO76t4GH4tKHTj66TuhJLKZKbh34mhCHUfTmujFsVV3BPoqWwWz1RmfB2tbt iGIg== MIME-Version: 1.0 X-Received: by 10.58.187.164 with SMTP id ft4mr6673256vec.5.1369938649228; Thu, 30 May 2013 11:30:49 -0700 (PDT) In-Reply-To: References: Date: Fri, 31 May 2013 04:30:49 +1000 Subject: Re: Python and GIL From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369938658 news.xs4all.nl 15947 [2001:888:2000:d::a6]:33849 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46526 On Fri, May 31, 2013 at 4:14 AM, Ana Marija Sokovic wrote: > Hi, > > Can somebody explain to me how would you proceed in releasing the GIL and > whether you think it will have consequences? You release the GIL in C-level code when you don't need to work with Python objects for a while. Simple example is when you need to wait for something - for instance, if you attempt to read from a pipe, you can release the GIL before reading, then reacquire it afterward. The consequence is that you can't do anything with Python objects till you reacquire it. It's like any other resource-guarding mutex lock. ChrisA