diff --git a/Foundation/src/Thread_POSIX.cpp b/Foundation/src/Thread_POSIX.cpp index 4235ab2f4..e879df804 100644 --- a/Foundation/src/Thread_POSIX.cpp +++ b/Foundation/src/Thread_POSIX.cpp @@ -72,7 +72,7 @@ namespace { #if (POCO_OS == POCO_OS_MAC_OS_X) if (pthread_setname_np(threadName.c_str())) -#else +#elif !defined(__EMSCRIPTEN__) if (pthread_setname_np(pthread_self(), threadName.c_str())) #endif throw Poco::SystemException("cannot get thread name"); @@ -81,7 +81,9 @@ namespace std::string getThreadName() { char name[POCO_MAX_THREAD_NAME_LEN + 1]{'\0'}; +#if !defined(__EMSCRIPTEN__) if (pthread_getname_np(pthread_self(), name, POCO_MAX_THREAD_NAME_LEN + 1)) +#endif throw Poco::SystemException("cannot get thread name"); return name; } @@ -318,7 +320,7 @@ ThreadImpl::TIDImpl ThreadImpl::currentTidImpl() long ThreadImpl::currentOsTidImpl() { -#if POCO_OS == POCO_OS_LINUX +#if POCO_OS == POCO_OS_LINUX && !defined(__EMSCRIPTEN__) return ::syscall(SYS_gettid); #elif POCO_OS == POCO_OS_MAC_OS_X return ::pthread_mach_thread_np(::pthread_self());