Masayuki Yamamoto added the comment:

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);

----------
Added file: http://bugs.python.org/file45548/configure-pthread_key_t.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25658>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to