Skip to content

Commit

Permalink
Android does not yet have pthread_getname_np in the NDK.
Browse files Browse the repository at this point in the history
  • Loading branch information
rpavlik committed Jan 24, 2022
1 parent ee9ad62 commit 7d6f784
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/percetto.cc
Expand Up @@ -153,10 +153,15 @@ static const char* TryGetProcessExeName(char* buffer, size_t buffer_size) {

static const char* TryGetThreadName(char* buffer, size_t buffer_size) {
pthread_t thread = pthread_self();
#if defined(__ANDROID__)
// pthread_getname_np not yet supported in Android NDK
return NULL;
#else
int result = pthread_getname_np(thread, buffer, buffer_size);
if (result != 0)
return NULL;
return buffer;
#endif
}

static uint64_t GetTrackUuid(uint64_t trackid) {
Expand Down

0 comments on commit 7d6f784

Please sign in to comment.