diff options
author | Christian Heimes <christian@python.org> | 2022-07-27 18:28:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 18:28:06 (GMT) |
commit | 0fe645d6fd22a6f57e777a29e65cf9a4ff9785ae (patch) | |
tree | a6222de1305545869eed745741bbf1f1b3e5f728 /Python/thread.c | |
parent | 226d02bb109d08601fbccd645e9d67aee2e5bcdc (diff) | |
download | cpython-0fe645d6fd22a6f57e777a29e65cf9a4ff9785ae.zip cpython-0fe645d6fd22a6f57e777a29e65cf9a4ff9785ae.tar.gz cpython-0fe645d6fd22a6f57e777a29e65cf9a4ff9785ae.tar.bz2 |
gh-95174: Add pthread stubs for WASI (GH-95234)
Co-authored-by: Brett Cannon <brett@python.org>
Diffstat (limited to 'Python/thread.c')
-rw-r--r-- | Python/thread.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Python/thread.c b/Python/thread.c index d321121..e206a69 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -55,8 +55,15 @@ PyThread_init_thread(void) PyThread__init_thread(); } -#if defined(_POSIX_THREADS) -# define PYTHREAD_NAME "pthread" +#if defined(HAVE_PTHREAD_STUBS) +# define PYTHREAD_NAME "pthread-stubs" +# include "thread_pthread_stubs.h" +#elif defined(_POSIX_THREADS) +# if defined(__EMSCRIPTEN__) || !defined(__EMSCRIPTEN_PTHREADS__) +# define PYTHREAD_NAME "pthread-stubs" +# else +# define PYTHREAD_NAME "pthread" +# endif # include "thread_pthread.h" #elif defined(NT_THREADS) # define PYTHREAD_NAME "nt" @@ -171,7 +178,9 @@ PyThread_GetInfo(void) } PyStructSequence_SET_ITEM(threadinfo, pos++, value); -#ifdef _POSIX_THREADS +#ifdef HAVE_PTHREAD_STUBS + value = Py_NewRef(Py_None); +#elif defined(_POSIX_THREADS) #ifdef USE_SEMAPHORES value = PyUnicode_FromString("semaphore"); #else @@ -182,8 +191,7 @@ PyThread_GetInfo(void) return NULL; } #else - Py_INCREF(Py_None); - value = Py_None; + value = Py_NewRef(Py_None); #endif PyStructSequence_SET_ITEM(threadinfo, pos++, value); |