Message281227
| Author |
masamoto |
| Recipients |
EdSchouten, erik.bray, masamoto, r.david.murray, vstinner |
| Date |
2016年11月19日.19:28:49 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1479583730.84.0.404415930447.issue25658@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I wrote a patch to avoid compile error for platforms that pthread_key_t is not integer.
This patch changes to turn off Py_HAVE_NATIVE_TLS if pthread_key_t is not integer. Hence the platforms use TLS functions implemented by CPython self.
And, I would propose new thread local storage API based on C11 thread and current TLS functions move to deprecated. C11 tss_t doesn't require defined as integer [1]. Therefore I think new API should use tss_t, not hide into integer.
[1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf (page 394)
I'm thinking of new interfaces. For example, declaration in Include/pythread.h
/* Specialise to each platforms using #if directive */
typedef /* TLS key types or C11 tss_t */ Py_tss_t;
/* Based on C11 threads.h, but destructor doesn't support.
the delete value function is maintained for the implementation by CPython self.
*/
PyAPI_FUNC(int) PyThread_tss_create(Py_tss_t *);
PyAPI_FUNC(void) PyThread_tss_delete(Py_tss_t);
PyAPI_FUNC(void *) PyThread_tss_get(Py_tss_t);
PyAPI_FUNC(int) PyThread_tss_set(Py_tss_t, void *);
PyAPI_FUNC(void) PyThread_tss_delete_value(Py_tss_t); |
|