src/thread/pthread/SDL_systhread.c
changeset 9846 9f0a0c7de41a
parent 9755 e4f04633f291
child 9987 d64783aac765
equal deleted inserted replaced
9845:41ce18cb4b3b 9846:9f0a0c7de41a
    85 #endif
    85 #endif
    86 int
    86 int
    87 SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
    87 SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
    88 {
    88 {
    89     pthread_attr_t type;
    89     pthread_attr_t type;
    90     size_t ss;
       
    91     const char *hint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE);
    90     const char *hint = SDL_GetHint(SDL_HINT_THREAD_STACK_SIZE);
    92 
    91 
    93     /* do this here before any threads exist, so there's no race condition. */
    92     /* do this here before any threads exist, so there's no race condition. */
    94     #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
    93     #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
    95     if (!checked_setname) {
    94     if (!checked_setname) {
   114         const size_t stacksize = (size_t) SDL_atoi(hint);
   113         const size_t stacksize = (size_t) SDL_atoi(hint);
   115         if (stacksize > 0) {
   114         if (stacksize > 0) {
   116             pthread_attr_setstacksize(&type, stacksize);
   115             pthread_attr_setstacksize(&type, stacksize);
   117         }
   116         }
   118     }
   117     }
   119     
       
   120     pthread_attr_getstacksize(&type, &ss);
       
   121 
   118 
   122     /* Create the thread and go! */
   119     /* Create the thread and go! */
   123     if (pthread_create(&thread->handle, &type, RunThread, args) != 0) {
   120     if (pthread_create(&thread->handle, &type, RunThread, args) != 0) {
   124         return SDL_SetError("Not enough resources to create thread");
   121         return SDL_SetError("Not enough resources to create thread");
   125     }
   122     }