Skip to content

Commit

Permalink
Properly hook up pthread_getname_np on ATV (#3101)
Browse files Browse the repository at this point in the history
b/302335657

Change-Id: Ic1d28aa6ad1c4cdedbf319f00adf9073b2430fe1
  • Loading branch information
y4vor committed Apr 27, 2024
1 parent 1bfff82 commit 135a867
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions starboard/android/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ static_library("starboard_platform") {
"player_set_max_video_input_size.h",
"player_set_playback_rate.cc",
"posix_emu/errno.cc",
"posix_emu/pthread.cc",
"posix_emu/stat.cc",
"sanitizer_options.cc",
"socket_get_interface_address.cc",
Expand Down
8 changes: 8 additions & 0 deletions starboard/android/shared/posix_emu/include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@

#include_next <pthread.h>

#ifdef __cplusplus
extern "C" {
#endif

#if __ANDROID_API__ < 26
int pthread_getname_np(pthread_t thread, char* name, size_t len);
#endif // __ANDROID_API__ < 26

#ifdef __cplusplus
}
#endif

#endif // STARBOARD_ANDROID_SHARED_POSIX_EMU_INCLUDE_PTHREAD_H_
3 changes: 3 additions & 0 deletions starboard/android/shared/posix_emu/pthread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <sys/prctl.h>
#include <unistd.h>

extern "C" {

#if __ANDROID_API__ < 26
// The API doesn exist before API Level 26 and we currently target 24
// If this is the current thread we can obtain the name using `prctl`.
Expand All @@ -30,4 +32,5 @@ int pthread_getname_np(pthread_t thread, char* name, size_t len) {
}
return -1;
}
}
#endif // __ANDROID_API__ < 26

0 comments on commit 135a867

Please sign in to comment.