gh-125161: return non zero value in pthread_self on wasi (#125303)

This commit is contained in:
Kumar Aditya 2024-10-13 20:59:41 +05:30 committed by GitHub
parent 022c50d190
commit 08489325d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,9 @@
#include "cpython/pthread_stubs.h" #include "cpython/pthread_stubs.h"
typedef struct py_stub_tls_entry py_tls_entry;
#define py_tls_entries (_PyRuntime.threads.stubs.tls_entries)
// mutex // mutex
int int
pthread_mutex_init(pthread_mutex_t *restrict mutex, pthread_mutex_init(pthread_mutex_t *restrict mutex,
@ -105,7 +109,7 @@ pthread_join(pthread_t thread, void** value_ptr)
PyAPI_FUNC(pthread_t) pthread_self(void) PyAPI_FUNC(pthread_t) pthread_self(void)
{ {
return 0; return (pthread_t)(uintptr_t)&py_tls_entries;
} }
int int
@ -134,10 +138,6 @@ pthread_attr_destroy(pthread_attr_t *attr)
} }
typedef struct py_stub_tls_entry py_tls_entry;
#define py_tls_entries (_PyRuntime.threads.stubs.tls_entries)
int int
pthread_key_create(pthread_key_t *key, void (*destr_function)(void *)) pthread_key_create(pthread_key_t *key, void (*destr_function)(void *))
{ {