mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Fix accessing the thread id on Android
This commit is contained in:
parent
f04e67779c
commit
69dac3f611
@ -7,8 +7,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <syscall.h>
|
# ifndef __ANDROID__
|
||||||
#include <fcntl.h>
|
# include <syscall.h>
|
||||||
|
# endif
|
||||||
|
# include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
@ -148,7 +150,11 @@ const char* GetThreadName( uint64_t id )
|
|||||||
# elif defined __linux__
|
# elif defined __linux__
|
||||||
int cs, fd;
|
int cs, fd;
|
||||||
char path[32];
|
char path[32];
|
||||||
|
# ifdef __ANDROID__
|
||||||
|
int tid = gettid();
|
||||||
|
# else
|
||||||
int tid = (int) syscall( SYS_gettid );
|
int tid = (int) syscall( SYS_gettid );
|
||||||
|
# endif
|
||||||
snprintf( path, sizeof( path ), "/proc/self/task/%d/comm", tid );
|
snprintf( path, sizeof( path ), "/proc/self/task/%d/comm", tid );
|
||||||
sprintf( buf, "%" PRIu64, id );
|
sprintf( buf, "%" PRIu64, id );
|
||||||
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &cs );
|
pthread_setcancelstate( PTHREAD_CANCEL_DISABLE, &cs );
|
||||||
|
Loading…
Reference in New Issue
Block a user