Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #3101: Properly hook up pthread_getname_np on ATV #3102

Merged
merged 3 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions starboard/android/shared/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ static_library("starboard_platform") {
"player_set_max_video_input_size.cc",
"player_set_max_video_input_size.h",
"player_set_playback_rate.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
Loading