diff options
author | Christian Heimes <christian@python.org> | 2022-08-01 14:37:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-01 14:37:45 (GMT) |
commit | e62a0dfab2bbc29324ca1879e287fff7fa8f21e0 (patch) | |
tree | 024357a512b6fa49ce42c8c331de3d2e56851bc2 /Python/thread.c | |
parent | 9af9ea28e756a8a1961b065856c697fc1262ca82 (diff) | |
download | cpython-e62a0dfab2bbc29324ca1879e287fff7fa8f21e0.zip cpython-e62a0dfab2bbc29324ca1879e287fff7fa8f21e0.tar.gz cpython-e62a0dfab2bbc29324ca1879e287fff7fa8f21e0.tar.bz2 |
[3.11] gh-95174: Add pthread stubs for WASI (GH-95234) (#95503)
Co-authored-by: Brett Cannon <brett@python.org>.
(cherry picked from commit 0fe645d6fd22a6f57e777a29e65cf9a4ff9785ae)
Co-authored-by: Christian Heimes <christian@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 e80e8a9..08bcdda 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -93,8 +93,15 @@ _PyThread_debug_deprecation(void) #endif } -#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" @@ -208,7 +215,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 @@ -219,8 +228,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); |