diff options
Diffstat (limited to 'Python/thread_pthread.h')
-rw-r--r-- | Python/thread_pthread.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h index f588b46..c010b3a 100644 --- a/Python/thread_pthread.h +++ b/Python/thread_pthread.h @@ -16,6 +16,7 @@ #undef destructor #endif #include <signal.h> +#include <unistd.h> /* pause(), also getthrid() on OpenBSD */ #if defined(__linux__) # include <sys/syscall.h> /* syscall(SYS_gettid) */ @@ -23,8 +24,6 @@ # include <pthread_np.h> /* pthread_getthreadid_np() */ #elif defined(__FreeBSD_kernel__) # include <sys/syscall.h> /* syscall(SYS_thr_self) */ -#elif defined(__OpenBSD__) -# include <unistd.h> /* getthrid() */ #elif defined(_AIX) # include <sys/thread.h> /* thread_self() */ #elif defined(__NetBSD__) @@ -419,6 +418,18 @@ PyThread_exit_thread(void) #endif } +void _Py_NO_RETURN +PyThread_hang_thread(void) +{ + while (1) { +#if defined(__wasi__) + sleep(9999999); // WASI doesn't have pause() ?! +#else + pause(); +#endif + } +} + #ifdef USE_SEMAPHORES /* |