Don't crash with a NULL thread name.

This commit is contained in:
Ryan C. Gordon 2011-10-18 00:34:45 -04:00
parent 3d70224c40
commit b5692bd236
3 changed files with 26 additions and 21 deletions

View file

@ -82,14 +82,16 @@ SDL_SYS_SetupThread(const char *name)
int i;
sigset_t mask;
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); }
if (pthread_setname_np != NULL) { pthread_setname_np(name); }
#elif HAVE_PTHREAD_SETNAME_NP
pthread_setname_np(pthread_self(), name);
pthread_setname_np(pthread_self(), name);
#elif HAVE_PTHREAD_SET_NAME_NP
pthread_set_name_np(pthread_self(), name);
pthread_set_name_np(pthread_self(), name);
#endif
}
/* Mask asynchronous signals for this thread */
sigemptyset(&mask);