On Wed, Dec 21, 2016 at 11:01 AM, Erik Bray <erik.m.b...@gmail.com> wrote: > That all sounds good--between the two option 2 looks a bit more explicit. > > Though what about this? Rather than adding another type, the original > proposal could be changed slightly so that Py_tss_t *is* partially > defined as a struct consisting of a bool, with whatever the native TLS > key is. E.g. > > typedef struct { > bool init_flag; > #if defined(_POSIX_THREADS) > pthreat_key_t key;
*pthread_key_t* of course, though I wonder if that was a Freudian slip :) > #elif defined (NT_THREADS) > DWORD key; > /* etc... */ > } Py_tss_t; > > Then it's just taking Masayuki's original patch, with the global bool > variables, and formalizing that by combining the initialized flag with > the key, and requiring the semantics you described above for > PyThread_tss_create/delete. > > For Python's purposes it seems like this might be good enough, with > the more general purpose pthread_once-like functionality not required. Of course, that's not to say it might not be useful for some other purpose, but then it's outside the scope of this discussion as long as it isn't needed for TLS key initialization. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/