diff --git a/starboard/android/shared/BUILD.gn b/starboard/android/shared/BUILD.gn index 6ee03675b1f3..72ce1e37320f 100644 --- a/starboard/android/shared/BUILD.gn +++ b/starboard/android/shared/BUILD.gn @@ -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", diff --git a/starboard/android/shared/posix_emu/include/pthread.h b/starboard/android/shared/posix_emu/include/pthread.h index 1c10db2da10f..b1f7d926dec0 100644 --- a/starboard/android/shared/posix_emu/include/pthread.h +++ b/starboard/android/shared/posix_emu/include/pthread.h @@ -17,8 +17,16 @@ #include_next +#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_ diff --git a/starboard/android/shared/posix_emu/pthread.cc b/starboard/android/shared/posix_emu/pthread.cc index 633b11e5e44b..da2f1a0070ad 100644 --- a/starboard/android/shared/posix_emu/pthread.cc +++ b/starboard/android/shared/posix_emu/pthread.cc @@ -19,6 +19,8 @@ #include #include +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`. @@ -30,4 +32,5 @@ int pthread_getname_np(pthread_t thread, char* name, size_t len) { } return -1; } +} #endif // __ANDROID_API__ < 26