Only use pthread_setname_np on Android >= 9 (2.3)

Older versions of Android don't have this function.
This commit is contained in:
Martin Storsjö
2014-10-23 15:36:40 +03:00
parent 94a1d4426e
commit 0a3d4c4ebc

View File

@@ -58,6 +58,9 @@
#ifdef ANDROID_NDK
#include <cpu-features.h>
#endif
#ifdef __ANDROID__
#include <android/api-level.h>
#endif
#include "WelsThreadLib.h"
#include <stdio.h>
@@ -252,7 +255,7 @@ WELS_THREAD_ERROR_CODE WelsThreadSetName (const char* thread_name) {
#ifdef APPLE_IOS
pthread_setname_np(thread_name);
#endif
#ifdef __ANDROID__
#if defined(__ANDROID__) && __ANDROID_API__ >= 9
pthread_setname_np(pthread_self(), thread_name);
#endif
// do nothing