Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78346
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.024 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'subject:same': 0.07; 'callback': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; 'block.': 0.16; 'enough.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'imo.': 0.16; 'recipe': 0.16; 'subject: \n ': 0.16; 'subject:run': 0.16; 'wrote:': 0.18; 'stack': 0.19; 'examples': 0.20; 'not,': 0.20; 'example': 0.22; 'cc:addr:python.org': 0.22; 'this?': 0.23; 'cc:2**0': 0.24; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'argue': 0.31; 'sep': 0.31; 'probably': 0.32; 'fri,': 0.33; 'subject:the': 0.34; "i'd": 0.34; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'moving': 0.39; 'either': 0.39; 'above,': 0.60; 'ian': 0.60; 'simply': 0.61; 'simple': 0.61; 'further': 0.61; 'more': 0.64; '26,': 0.68; 'subject:skip:T 10': 0.68; 'isolate': 0.84; 'to:none': 0.92; 'imagine': 0.93 |
| 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=MpaosjTESuZypng15bHUd3nnm6X5ANQKiw/7xzuOtkw=; b=Q5/L3Z46D1QybL4PmyxWGlaSrS8eBLeLrqKpOslG9eI7d1KxzzO4n+dRjZVvBuycrh mKzcLf0qyiNURR70amdXDc9I4nlO4BmMLEXYsp9AJBnCXp7taGF3slF8cW6Fas/9gCyb pvRJvNGnQrX3jp2hV0vVufVbM4xkizoJl5NP32OzQwZUNGiSPRwd+JP15twjyBPw8/Qm Qh5ER/2+Qe8yJRjHdr8rxkPWbsXRtYlV5+HMNKflsmhGbeJ565cCzntFrNFH2JvLU0CW X43DmC8NwoiPE1OA4d1Hx4jnI6H2IjsyHnBK9fsFGAUW8Uagk77u+24KP9U3HhGBtzYf XqyA== |
| MIME-Version | 1.0 |
| X-Received | by 10.42.92.129 with SMTP id t1mr19514471icm.59.1411661080990; Thu, 25 Sep 2014 09:04:40 -0700 (PDT) |
| In-Reply-To | <CALwzidmjSJDMLCO2FTEw-OXrgmTbSx5zhMetC=k+H3+UGLGGww@mail.gmail.com> |
| References | <e2f400e6-359e-4070-a822-d734e85e6a75@googlegroups.com> <mailman.14345.1411627213.18130.python-list@python.org> <871tr06nhs.fsf@elektro.pacujo.net> <mailman.14358.1411654608.18130.python-list@python.org> <87sijf69k5.fsf@elektro.pacujo.net> <CALwzidmjSJDMLCO2FTEw-OXrgmTbSx5zhMetC=k+H3+UGLGGww@mail.gmail.com> |
| Date | Fri, 26 Sep 2014 02:04:40 +1000 |
| Subject | Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | Python <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 <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14362.1411661084.18130.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1411661084 news.xs4all.nl 2957 [2001:888:2000:d::a6]:56033 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:78346 |
Show key headers only | View raw
On Fri, Sep 26, 2014 at 1:40 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> Fair enough. In the simple example above, I see no harm in simply
> moving the add_done_callback call outside (after) the "with self.lock"
> block altogether. I can imagine more complex examples where the call
> is further down the stack and harder to isolate from the lock,
> although I would argue that's probably a code smell.
I'd definitely call it code smell. What happens with this?
with lock:
def inner():
do_more_work()
f.add_done_callback(inner)
The lock's possibly released before the callback happens, or possibly
not, but either way, the code *looks* as if it's all happening inside
the "with lock" block. Recipe for confusion IMO.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Praveen Gollakota <pgollakota@gmail.com> - 2014-09-24 07:44 -0700
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? dieter <dieter@handshake.de> - 2014-09-25 08:14 +0200
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-25 00:39 -0600
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Marko Rauhamaa <marko@pacujo.net> - 2014-09-25 12:46 +0300
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-25 08:16 -0600
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Marko Rauhamaa <marko@pacujo.net> - 2014-09-25 17:47 +0300
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Ian Kelly <ian.g.kelly@gmail.com> - 2014-09-25 09:40 -0600
Re: ThreadPoolExecutor - callback guaranteed to run in same thread as the submitted function? Chris Angelico <rosuav@gmail.com> - 2014-09-26 02:04 +1000
csiph-web