Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed running SDL on older versions of Mac OS X. pthread_setname_np()…

… was introduced in 10.6.
  • Loading branch information
slouken committed Oct 23, 2012
1 parent 956cbc4 commit fd1a84b0e8a6617fe94f970c9318456385d7934b
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/thread/pthread/SDL_systhread.c
@@ -33,8 +33,11 @@
#include <sys/resource.h>
#include <sys/syscall.h>
#include <unistd.h>

#if HAVE_PTHREAD_SETNAME_NP
extern int pthread_setname_np (pthread_t __target_thread, __const char *__name) __THROW __nonnull ((2));
#endif
#endif // __LINUX__

#include "SDL_platform.h"
#include "SDL_thread.h"
@@ -91,7 +94,10 @@ SDL_SYS_SetupThread(const char *name)
if (name != NULL) {
#if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
(__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
if (pthread_setname_np != NULL) { pthread_setname_np(name); }
int (*dynamic_pthread_setname_np)(const char*);
*reinterpret_cast<void**>(&dynamic_pthread_setname_np) = dlsym(RTLD_DEFAULT, "pthread_setname_np");
if ( dynamic_pthread_setname_np )
dynamic_pthread_setname_np( name );
#elif HAVE_PTHREAD_SETNAME_NP
pthread_setname_np(pthread_self(), name);
#elif HAVE_PTHREAD_SET_NAME_NP

0 comments on commit fd1a84b

Please sign in to comment.