src/thread/pthread/SDL_systhread.c
changeset 6600 f16fc9564de4
parent 6354 17840f487124
child 6604 70292a6d7dca
     1.1 --- a/src/thread/pthread/SDL_systhread.c	Tue Oct 23 15:59:07 2012 -0700
     1.2 +++ b/src/thread/pthread/SDL_systhread.c	Tue Oct 23 16:06:06 2012 -0700
     1.3 @@ -33,8 +33,11 @@
     1.4  #include <sys/resource.h>
     1.5  #include <sys/syscall.h>
     1.6  #include <unistd.h>
     1.7 +
     1.8 +#if HAVE_PTHREAD_SETNAME_NP
     1.9  extern int pthread_setname_np (pthread_t __target_thread, __const char *__name) __THROW __nonnull ((2));
    1.10  #endif
    1.11 +#endif // __LINUX__
    1.12  
    1.13  #include "SDL_platform.h"
    1.14  #include "SDL_thread.h"
    1.15 @@ -91,7 +94,10 @@
    1.16      if (name != NULL) {
    1.17  #if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
    1.18        (__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
    1.19 -        if (pthread_setname_np != NULL) { pthread_setname_np(name); }
    1.20 +        int (*dynamic_pthread_setname_np)(const char*);
    1.21 +        *reinterpret_cast<void**>(&dynamic_pthread_setname_np) = dlsym(RTLD_DEFAULT, "pthread_setname_np");
    1.22 +        if ( dynamic_pthread_setname_np )
    1.23 +            dynamic_pthread_setname_np( name );
    1.24  #elif HAVE_PTHREAD_SETNAME_NP
    1.25          pthread_setname_np(pthread_self(), name);
    1.26  #elif HAVE_PTHREAD_SET_NAME_NP