mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Use windows thread ids on cygwin.
This commit is contained in:
parent
71a5cffc13
commit
73cbf2eead
@ -15,6 +15,7 @@
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <windows.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <pthread.h>
|
||||
@ -34,6 +34,21 @@
|
||||
# include "TracyAlloc.hpp"
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
class stub1 // verifyable_object
|
||||
{
|
||||
public:
|
||||
uint32_t x;
|
||||
virtual ~stub1();
|
||||
};
|
||||
class stub2 : public stub1 // pthread
|
||||
{
|
||||
public:
|
||||
HANDLE hnd;
|
||||
virtual ~stub2();
|
||||
};
|
||||
#endif
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
@ -87,7 +102,7 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
{
|
||||
}
|
||||
# endif
|
||||
#elif defined _GNU_SOURCE && !defined __EMSCRIPTEN__
|
||||
#elif defined _GNU_SOURCE && !defined __EMSCRIPTEN__ && !defined __CYGWIN__
|
||||
{
|
||||
const auto sz = strlen( name );
|
||||
if( sz <= 15 )
|
||||
@ -121,6 +136,9 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
# endif
|
||||
# elif defined __APPLE__
|
||||
pthread_threadid_np( handle, &data->id );
|
||||
# elif defined __CYGWIN__
|
||||
|
||||
data->id = GetThreadId( ((stub2*)handle)->hnd );
|
||||
# else
|
||||
data->id = (uint64_t)handle;
|
||||
# endif
|
||||
@ -160,7 +178,7 @@ const char* GetThreadName( uint64_t id )
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# elif defined __GLIBC__ && !defined __ANDROID__ && !defined __EMSCRIPTEN__
|
||||
# elif defined __GLIBC__ && !defined __ANDROID__ && !defined __EMSCRIPTEN__ && !defined __CYGWIN__
|
||||
if( pthread_getname_np( (pthread_t)id, buf, 256 ) == 0 )
|
||||
{
|
||||
return buf;
|
||||
|
Loading…
Reference in New Issue
Block a user