Am 13.09.2010 10:00, schrieb Kristján Valur Jónsson:
>
> Kristján Valur Jónsson <kristjan@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. |