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