[Python-ideas] New PyThread_tss_ C-API for CPython
Masayuki YAMAMOTO
ma3yuki.8mamo10 at gmail.com
Tue Dec 20 10:35:13 EST 2016
2016-12-20 22:30 GMT+09:00 Erik Bray <erik.m.bray at gmail.com>:
> This is probably an implementation detail, but ISTM that even with
> PyThread_call_once, it will be necessary to reset any used once_flags
> manually in PyOS_AfterFork, essentially for the same reason the
> autoTLSkey is reset there currently...
>
Deleting threads key is executed on *_Fini functions, but Py_FinalizeEx
function that calls *_Fini functions doesn't terminate CPython interpreter.
Furthermore, source comment and document have said description about
reinitialization after calling Py_FinalizeEx. [1] [2] That is to say there
is an implicit possible that is reinitialization contrary to name
"call_once" on a process level. Therefore, if CPython interpreter continues
to allow reinitialization, I'd suggest to rename the call_once API to avoid
misreading semantics. (for example, safe_init, check_init)
Best regards,
Masayuki
[1] https://hg.python.org/cpython/file/default/Python/pylifecycle.c#l170
[2] https://docs.python.org/dev/c-api/init.html#c.Py_FinalizeEx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161221/4c8fcecf/attachment.html>
More information about the Python-ideas
mailing list