Skip to content

Commit

Permalink
use weak emscripten_main_browser_thread_id
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Mar 28, 2023
1 parent 1b62723 commit f6da36b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/emnapi/src/uv/unix/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ EMNAPI_INTERNAL_EXTERN void _emnapi_next_tick(void (*callback)(void*), void* dat
#endif

#if EMNAPI_USE_PROXYING
#include <emscripten.h>
#include <emscripten/threading.h>
#include <emscripten/proxying.h>
#include <errno.h>
Expand Down Expand Up @@ -153,13 +152,19 @@ static void uv__async_io(uv_loop_t* loop) {
}

#if EMNAPI_USE_PROXYING

#ifdef emscripten_main_browser_thread_id
#undef emscripten_main_browser_thread_id
#endif

__attribute__((weak))
pthread_t emscripten_main_runtime_thread_id(void) {
#if __EMSCRIPTEN_major__ * 10000 + __EMSCRIPTEN_minor__ * 100 + __EMSCRIPTEN_tiny__ >= 30133
pthread_t emscripten_main_browser_thread_id(void) {
return NULL;
#else
}

__attribute__((weak))
pthread_t emscripten_main_runtime_thread_id(void) {
return emscripten_main_browser_thread_id();
#endif
}
#endif

Expand Down

0 comments on commit f6da36b

Please sign in to comment.