Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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 fd1a84b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/thread/pthread/SDL_systhread.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd1a84b

Please sign in to comment.