File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include < kj/common.h>
1313#include < kj/debug.h>
1414#include < kj/string-tree.h>
15- #include < pthread.h>
1615#include < sstream>
1716#include < string>
1817#include < system_error>
1918#include < thread> // NOLINT(misc-include-cleaner) // IWYU pragma: keep
20- #include < unistd.h>
2119#include < utility>
2220#include < vector>
2321
2422#ifdef WIN32
2523#include < atomic>
24+ #include < process.h>
2625#include < windows.h>
2726#include < winsock2.h>
2827#else
2928#include < fcntl.h>
29+ #include < pthread.h>
3030#include < sys/resource.h>
3131#include < sys/socket.h>
3232#include < sys/types.h>
3333#include < sys/wait.h>
34+ #include < unistd.h>
35+ #define _getpid getpid
3436#endif
3537
3638#ifdef __linux__
@@ -80,12 +82,12 @@ size_t MaxFd()
8082std::string ThreadName (const char * exe_name)
8183{
8284 char thread_name[16 ] = {0 };
83- #ifdef HAVE_PTHREAD_GETNAME_NP
85+ #if defined( HAVE_PTHREAD_GETNAME_NP) && !defined(WIN32)
8486 pthread_getname_np (pthread_self (), thread_name, sizeof (thread_name));
8587#endif // HAVE_PTHREAD_GETNAME_NP
8688
8789 std::ostringstream buffer;
88- buffer << (exe_name ? exe_name : " " ) << " -" << getpid () << " /" ;
90+ buffer << (exe_name ? exe_name : " " ) << " -" << _getpid () << " /" ;
8991
9092 if (thread_name[0 ] != ' \0 ' ) {
9193 buffer << thread_name << " -" ;
You can’t perform that action at this time.
0 commit comments