Skip to content

Commit

Permalink
Add gettid for emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
tidwall committed May 12, 2024
1 parent 3d4da9f commit 5f48ee0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion neco.c
Original file line number Diff line number Diff line change
Expand Up @@ -3670,10 +3670,15 @@ static struct coroutine *evexists(int fd, enum evkind kind) {
static int is_main_thread(void) {
return IsGUIThread(false);
}
#elif defined(__linux__) || defined(__EMSCRIPTEN__)
#elif defined(__linux__)
static int is_main_thread(void) {
return getpid() == (pid_t)syscall(SYS_gettid);
}
#elif defined(__EMSCRIPTEN__)
int gettid(void);
static int is_main_thread(void) {
return getpid() == gettid();
}
#else
int pthread_main_np(void);
static int is_main_thread(void) {
Expand Down Expand Up @@ -8689,6 +8694,7 @@ static void iowork(void *udata) {
#endif

static int workfn(int64_t pin, void(*work)(void *udata), void *udata) {
(void)pin;
struct coroutine *co = coself();
if (!work) {
return NECO_INVAL;
Expand Down

0 comments on commit 5f48ee0

Please sign in to comment.