mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 09:14:36 +00:00
Add threading helpers.
This commit is contained in:
parent
6885dc3fd3
commit
b0f94f6b45
29
client/TracyThread.hpp
Executable file
29
client/TracyThread.hpp
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef __TRACYTHREAD_HPP__
|
||||||
|
#define __TRACYTHREAD_HPP__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace tracy
|
||||||
|
{
|
||||||
|
|
||||||
|
static inline uint64_t GetThreadHandle()
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
static_assert( sizeof( decltype( GetCurrentThreadId() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" );
|
||||||
|
return uint64_t( GetCurrentThreadId() );
|
||||||
|
#else
|
||||||
|
static_assert( sizeof( decltype( pthread_self() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" );
|
||||||
|
return uint64_t( pthread_self() );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user