Skip to content

Commit

Permalink
pythongh-125161: return non zero value in pthread_self on wasi (pytho…
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 authored Oct 13, 2024
1 parent 022c50d commit 0848932
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Python/thread_pthread_stubs.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "cpython/pthread_stubs.h"

typedef struct py_stub_tls_entry py_tls_entry;

#define py_tls_entries (_PyRuntime.threads.stubs.tls_entries)

// mutex
int
pthread_mutex_init(pthread_mutex_t *restrict mutex,
Expand Down Expand Up @@ -105,7 +109,7 @@ pthread_join(pthread_t thread, void** value_ptr)

PyAPI_FUNC(pthread_t) pthread_self(void)
{
return 0;
return (pthread_t)(uintptr_t)&py_tls_entries;
}

int
Expand Down Expand Up @@ -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
pthread_key_create(pthread_key_t *key, void (*destr_function)(void *))
{
Expand Down

0 comments on commit 0848932

Please sign in to comment.