[issue9786] Native TLS support for pthreads

Martin v. Löwis report at bugs.python.org
Mon Sep 13 10:35:32 CEST 2010


Martin v. Löwis <martin at v.loewis.de> added the comment:

Am 13.09.2010 10:00, schrieb Kristján Valur Jónsson:
> 
> Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:
> 
> I've changed the function as you suggest, although there are in fact no failure detection semantics defined for PyThread_create_key().  

Right. That's why I'm thinking that we should introduce some. TLS
creation *can* fail, and it is unfortunate that the original
introduction of this API forgot to consider that. Your patch did
(de facto) introduce an error return code (originally 0, now -1).
So it would be good if this was documented, and the NT version adjusted.

In principle, this is really difficult to get right. AFAICT,
pthread_key_t doesn't even have to be an integral type, and even
if it is, it may well become -1. However, we can probably worry
about this when a system comes along where this implementation
breaks.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9786>
_______________________________________


More information about the Python-bugs-list mailing list