mirror of
https://github.com/wolfpld/tracy.git
synced 2026-08-05 04:49:19 +00:00
Fix builds with MingW.
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -51,7 +54,7 @@ void SetThreadName( std::thread& thread, const char* name )
|
||||
|
||||
void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined _WIN32 && !defined PTW32_VERSION && !defined __WINPTHREADS_VERSION
|
||||
# if defined NTDDI_WIN10_RS2 && NTDDI_VERSION >= NTDDI_WIN10_RS2
|
||||
wchar_t buf[256];
|
||||
mbstowcs( buf, name, 256 );
|
||||
@@ -108,7 +111,13 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
buf[sz+1] = '\0';
|
||||
auto data = (ThreadNameData*)tracy_malloc( sizeof( ThreadNameData ) );
|
||||
# ifdef _WIN32
|
||||
# if defined PTW32_VERSION
|
||||
data->id = pthread_getw32threadid_np( static_cast<pthread_t>( handle ) );
|
||||
# elif defined __WINPTHREADS_VERSION
|
||||
data->id = GetThreadId( pthread_gethandle( static_cast<pthread_t>( handle ) ) );
|
||||
# else
|
||||
data->id = GetThreadId( static_cast<HANDLE>( handle ) );
|
||||
# endif
|
||||
# elif defined __APPLE__
|
||||
pthread_threadid_np( handle, &data->id );
|
||||
# else
|
||||
|
||||
Reference in New Issue
Block a user