[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pypy-dev
Subject:    Re: [pypy-dev] FAQ entry
From:       William ML Leslie <william.leslie.ttg () gmail ! com>
Date:       2015-04-10 8:44:43
Message-ID: CAHgd1hEhq_g2RYhgtP+bCMapLWj0urnENHDi3YzHmRgnRn8_DQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On 8 April 2015 at 04:54, Yuriy Taraday <yorik.sar@gmail.com> wrote:

> Did you miss mailing list intentionally?
>

​Ach no!  I always seem to do this on pypy-dev.  Thanks for pointing that
out.​



>
> On Tue, Apr 7, 2015 at 5:59 PM William ML Leslie <
> william.leslie.ttg@gmail.com> wrote:
>
>> On 8 April 2015 at 00:00, Yuriy Taraday <yorik.sar@gmail.com> wrote:
>>
>>> GC introduces concurrency to user code anyway: call to some __del__
>>> method can happen in any time in user code, so it might be called in a
>>> separate thread just as well
>>>
>> ​
>> ​Obligatory: ​http://wingolog.org/archives/201
>> ​​
>> 2/02/16/unexpected-concurrency
>>
>
> Yes, that's how I see it: one can't bet on where and when finalizers are
> run, so they appear to the rest of the program as if they're run in some
> special thread that wake ups in some scary moments. So a separate thread is
> just as good for them.
>

Except that, up until now, you can expect that __del__ is run ​in /one/ of
the threads you've started.  If you only have one thread, you know exactly
which thread your __del__ will be run in.  So you could make assumptions
about thread-local state when you write such a method.

​Not that I have an opinion here.  __del__ is problematic, and entirely to
be avoided in new code, afaiac.​

-- 
William Leslie

Notice:
Likely much of this email is, by the nature of copyright, covered under
copyright law.  You absolutely MAY reproduce any part of it in accordance
with the copyright law of the nation you are reading this in.  Any attempt
to DENY YOU THOSE RIGHTS would be illegal without prior contractual
agreement.

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_extra">On 8 April 2015 at 04:54, Yuriy Taraday <span \
dir="ltr">&lt;<a href="mailto:yorik.sar@gmail.com" \
target="_blank">yorik.sar@gmail.com</a>&gt;</span> wrote:<br><div \
class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Did you miss \
mailing list intentionally?</div></div></blockquote><div><br><div \
class="gmail_default" style="font-family:courier new,monospace">​Ach no!   I always \
seem to do this on pypy-dev.   Thanks for pointing that out.​</div><br>  \
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_quote"><span class="">On \
Tue, Apr 7, 2015 at 5:59 PM William ML Leslie &lt;<a \
href="mailto:william.leslie.ttg@gmail.com" \
target="_blank">william.leslie.ttg@gmail.com</a>&gt; wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">On 8 April 2015 at \
00:00, Yuriy Taraday <span dir="ltr">&lt;<a href="mailto:yorik.sar@gmail.com" \
target="_blank">yorik.sar@gmail.com</a>&gt;</span> wrote:<br></div></div><div \
dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">GC introduces concurrency to user \
code anyway: call to some __del__ method can happen in any time in user code, so it \
might be called in a separate thread just as \
well<br></div></blockquote></div></div></div><div dir="ltr"><div \
class="gmail_extra"><div class="gmail_quote"><div><div style="font-family:courier \
new,monospace;display:inline">​<br></div>​Obligatory: ​<a \
href="http://wingolog.org/archives/201" \
target="_blank">http://wingolog.org/archives/201</a><div style="font-family:courier \
new,monospace;display:inline">​​</div>2/02/16/unexpected-concurrency<br></div></div></div></div></blockquote><div><br></div></span><div>Yes, \
that&#39;s how I see it: one can&#39;t bet on where and when finalizers are run, so \
they appear to the rest of the program as if they&#39;re run in some special thread \
that wake ups in some scary moments. So a separate thread is just as good for \
them.</div></div></div></blockquote><div><br><div class="gmail_default" \
style="font-family:courier new,monospace">Except that, up until now, you can expect \
that __del__ is run ​in /one/ of the threads you&#39;ve started.   If you only have \
one thread, you know exactly which thread your __del__ will be run in.   So you could \
make assumptions about thread-local state when you write such a method.<br \
clear="all"></div></div></div><br><div class="gmail_default" \
style="font-family:courier new,monospace">​Not that I have an opinion here.   \
__del__ is problematic, and entirely to be avoided in new code, \
afaiac.​</div><br>-- <br><div class="gmail_signature">William \
Leslie<br><br>Notice:<br>Likely much of this email is, by the nature of copyright, \
covered under copyright law.   You absolutely MAY reproduce any part of it in \
accordance with the copyright law of the nation you are reading this in.   Any \
attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual \
agreement.</div> </div></div>



_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic