Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.025 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'level,': 0.07; 'variables': 0.07; 'subject:help': 0.08; 'pixel': 0.09; 'python': 0.11; 'csv': 0.16; 'objects?': 0.16; 'stuff.': 0.16; 'threads.': 0.16; 'wrote:': 0.18; 'memory': 0.22; 'creating': 0.23; 'header :User-Agent:1': 0.23; 'manager.': 0.24; 'visible': 0.24; 'file.': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'releasing': 0.31; 'probably': 0.32; 'subject:with': 0.35; 'common': 0.35; 'tight': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'deleting': 0.60; 'making': 0.63; 'more': 0.64; 'received:74.208': 0.68; 'lowest': 0.74; 'calls,': 0.84; 'locked': 0.84; 'received:74.208.4.194': 0.84 Date: Mon, 20 May 2013 07:06:04 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Please help with Threading References: <20130520074514.GA33353@cskk.homeip.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:xEeqCKdzXiP9l7LyvmQQL0MEiYCQCGRrohiUQJy7PUt atz8dXAgf3SeZlv90gHJ/g573zHWQEm/Bv7hHYPbSvsFmXdOV8 wcjLr0WuboKfytgNihxabD9P23NhNRPQbLzsfyWHxQpHFEF2kh PNTQ3j82ffIKLiCTVvcULZL1SFjZS4p1e1O/HN++7n3/XedZU+ a3/TM4fZiUDUR/tvUcXYJNx1sPRwpk7wXbt+hnG+S+ozUtOxix 0J5qBe3ImJdPSb130TwUj+O3MHspS2ZDukQZ0Tm6/pg+bUCl+N MJYdlVmvsvZVNvu2gML5T7rAOfSBZlIOI87w+eM+qVsZK+ANPD WRetkkgdgAlwqHHS+4hg= 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369047977 news.xs4all.nl 16012 [2001:888:2000:d::a6]:35960 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45618 On 05/20/2013 03:55 AM, Fábio Santos wrote: > My use case was a tight loop processing an image pixel by pixel, or > crunching a CSV file. If it only uses local variables (and probably hold a > lock before releasing the GIL) it should be safe, no? > Are you making function calls, using system libraries, or creating or deleting any objects? All of these use the GIL because they use common data structures shared among all threads. At the lowest level, creating an object requires locked access to the memory manager. Don't forget, the GIL gets used much more for Python internals than it does for the visible stuff. -- DaveA