Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53752

Re: Multiprocessing / threading confusion

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.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.127
X-Spam-Level *
X-Spam-Evidence '*H*': 0.77; '*S*': 0.03; 'think,': 0.07; 'caller': 0.09; 'counting': 0.09; 'friday,': 0.09; 'thread': 0.14; '__del__': 0.16; 'called.': 0.16; 'destroyed.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'reliably': 0.16; 'wrote:': 0.18; 'paul': 0.24; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; 'usually': 0.31; 'sep': 0.31; 'fri,': 0.33; 'problem': 0.35; "can't": 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'that!': 0.36; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'called': 0.40; 'even': 0.60; 'subject: / ': 0.60; "you'll": 0.62; 'here': 0.66; 'bottom': 0.67; 'hang': 0.67; 'ending': 0.78; 'cycles.': 0.84; 'promptly': 0.84; 'subject:skip:M 10': 0.84; 'technically': 0.84; 'wow': 0.84; 'reliable,': 0.93; '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=q4ZaMO7rpHzHiI8mm/ziUl5WvlRcBai6JIeUJDw9jCM=; b=RQm1TNq4K03RYb7NCjFK3HJLKy+5lekKVAq4NmS/DnTW7NLulNRuQliqO907lzjpZV MiyIJdUO+K/NQHz5nFLOk/OfVOuypiivDyiMNXzpHEReXmiwqgc3dN+v1XRuM1vQ/A9Z 7QXh3ubP5P/56FhSucxnSlY6DWdjURCqsvkm358QNYdEwmE7jpjV44tA7k0PY006RdVX e6XxiXmQmF2oC1VuM3GWlmRVeswf7AWW8LY6m7tONrUpV42wZv/putQl24McIsf85s3t iJMkc3ntfJdbngng1ijrZYhcOEgF++VeN6Qf1Cz3r0HpdIfcAmnY6g7Uhv9ZwDZ2LwSV tQ/A==
MIME-Version 1.0
X-Received by 10.220.181.136 with SMTP id by8mr85006vcb.11.1378436449117; Thu, 05 Sep 2013 20:00:49 -0700 (PDT)
In-Reply-To <9d088493-8224-4a48-a2d3-5b7207dc8947@googlegroups.com>
References <ca7ea9d1-4dad-4a30-97b2-ad8536a1860b@googlegroups.com> <mailman.107.1378420122.5461.python-list@python.org> <9d088493-8224-4a48-a2d3-5b7207dc8947@googlegroups.com>
Date Fri, 6 Sep 2013 13:00:49 +1000
Subject Re: Multiprocessing / threading confusion
From Chris Angelico <rosuav@gmail.com>
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 <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.111.1378436451.5461.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1378436451 news.xs4all.nl 15863 [2001:888:2000:d::a6]:58880
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53752

Show key headers only | View raw


On Fri, Sep 6, 2013 at 9:34 AM, Paul Pittlerson <menkomigen6@gmail.com> wrote:
> On Friday, September 6, 2013 1:28:39 AM UTC+3, mar...@python.net wrote:
>
>> Also you can't (and shouldn't) depend on the time that __del__ gets
>> called.  It can get called at any time, in any order and sometimes not
>> at all.*
>
> Wow I did not know that! I was counting on that it reliably gets called when the object is destroyed.

Even that isn't technically reliable, though in CPython, objects will
usually be __del__'d promptly as long as they're not in reference
cycles.  But the main problem here is that the destruction of the
object has nothing to do with the ending of the thread or process; the
object will hang around for as long as the caller might want it.
You'll want to put your "end of process" code at the bottom of run(),
I think, unless there's some other place for it.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Multiprocessing / threading confusion Paul Pittlerson <menkomigen6@gmail.com> - 2013-09-05 12:27 -0700
  Re: Multiprocessing / threading confusion "marduk@python.net" <marduk@python.net> - 2013-09-05 18:28 -0400
    Re: Multiprocessing / threading confusion Paul Pittlerson <menkomigen6@gmail.com> - 2013-09-05 16:34 -0700
      Re: Multiprocessing / threading confusion Chris Angelico <rosuav@gmail.com> - 2013-09-06 13:00 +1000
  Re: Multiprocessing / threading confusion Chris Angelico <rosuav@gmail.com> - 2013-09-06 08:46 +1000
    Re: Multiprocessing / threading confusion Paul Pittlerson <menkomigen6@gmail.com> - 2013-09-05 17:03 -0700
      Re: Multiprocessing / threading confusion Piet van Oostrum <piet@vanoostrum.org> - 2013-09-05 23:54 -0400
        Re: Multiprocessing / threading confusion Piet van Oostrum <piet@vanoostrum.org> - 2013-09-06 00:28 -0400
  Re: Multiprocessing / threading confusion Paul Pittlerson <menkomigen6@gmail.com> - 2013-09-06 11:27 -0700
    Re: Multiprocessing / threading confusion Skip Montanaro <skip@pobox.com> - 2013-09-06 13:53 -0500
    Re: Multiprocessing / threading confusion Dave Angel <davea@davea.name> - 2013-09-06 20:34 +0000
    Re: Multiprocessing / threading confusion Piet van Oostrum <piet@vanoostrum.org> - 2013-09-06 17:15 -0400

csiph-web