Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'context': 0.07; 'nested': 0.07; 'subject:help': 0.08; '(instead': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'thread': 0.14; 'times,': 0.14; 'loops': 0.16; 'numpy': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'fine': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'pass': 0.26; 'header:In- Reply-To:1': 0.27; 'array': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'complete,': 0.31; 'another': 0.32; 'problem': 0.35; 'subject:with': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'doing': 0.36; 'should': 0.36; 'manager': 0.38; 'either': 0.39; 'free': 0.61; 'devices': 0.61; 'nobody': 0.68; 'intelligent': 0.74; '(while': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=xKIp+6GrXik1+7VBeBO/2iMiXpNoKo9d6pEV5wN95iQ=; b=ce0h6+ZSjCGG4XBHvLB8vnae7BFM3mq6Jl+QfwoozdoaZMshITZJVedxTlrg2WpP92 vtud9ost0JO5jY4xuaGNYHpPMKISzkkgcRwbZ7b/FpFGolMSDHrS5Ck49kajkKhVj/M2 vbN1NlVN/vzxfYgBI0uSt1ygO2KrVlOssOneigwsRjejbwIeET3BQrPjt/hYFoHsWAeI INZU4Noh0jNL2dtRbUy1eTMd6n3a1XiiQNIhIx/HhkAq1vnjCt6bpieIE0PPDEVDO4DV bRuWKoODPDb/7jvSxbLWmvnGoahtGY2cgCsYh7xjbwFBk1Uysc88vmBPzUVlYX8othpc e+GA== MIME-Version: 1.0 X-Received: by 10.49.26.198 with SMTP id n6mr22914400qeg.16.1369031117852; Sun, 19 May 2013 23:25:17 -0700 (PDT) In-Reply-To: <13lfp8lds6e2e41rtsnvqimcb6inu7p28o@invalid.netcom.com> References: <7baacf5a-0c50-4935-ad5b-148c208d759b@googlegroups.com> <13lfp8lds6e2e41rtsnvqimcb6inu7p28o@invalid.netcom.com> Date: Mon, 20 May 2013 07:25:17 +0100 Subject: Re: Please help with Threading From: =?ISO-8859-1?Q?F=E1bio_Santos?= To: Dennis Lee Bieber Content-Type: multipart/alternative; boundary=047d7b677304778a8c04dd206578 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369031126 news.xs4all.nl 15981 [2001:888:2000:d::a6]:35787 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45588 --047d7b677304778a8c04dd206578 Content-Type: text/plain; charset=ISO-8859-1 On 18 May 2013 20:33, "Dennis Lee Bieber" wrote: > Python threads work fine if the threads either rely on intelligent > DLLs for number crunching (instead of doing nested Python loops to > process a numeric array you pass it to something like NumPy which > releases the GIL while crunching a copy of the array) or they do lots of > I/O and have to wait for I/O devices (while one thread is waiting for > the write/read operation to complete, another thread can do some number > crunching). Has nobody thought of a context manager to allow a part of your code to free up the GIL? I think the GIL is not inherently bad, but if it poses a problem at times, there should be a way to get it out of your... Way. --047d7b677304778a8c04dd206578 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable


On 18 May 2013 20:33, "Dennis Lee Bieber" <wlfraed@ix.netcom.com> wrote:
> =A0 =A0 =A0 =A0 Python threads work fine if the threads either rely on= intelligent
> DLLs for number crunching (instead of doing nested Python loops to
> process a numeric array you pass it to something like NumPy which
> releases the GIL while crunching a copy of the array) or they do lots = of
> I/O and have to wait for I/O devices (while one thread is waiting for<= br> > the write/read operation to complete, another thread can do some numbe= r
> crunching).

Has nobody thought of a context manager to allow a part of y= our code to free up the GIL? I think the GIL is not inherently bad, but if = it poses a problem at times, there should be a way to get it out of your...= Way.

--047d7b677304778a8c04dd206578--