src/thread/SDL_thread.c
changeset 6977 b73d51026c68
parent 6885 700f1b25f77f
child 7191 75360622e65f
equal deleted inserted replaced
6976:177d1dc3dba6 6977:b73d51026c68
    83     if (!thread_lock) {
    83     if (!thread_lock) {
    84         if (SDL_ThreadsInit() < 0) {
    84         if (SDL_ThreadsInit() < 0) {
    85             return;
    85             return;
    86         }
    86         }
    87     }
    87     }
    88     SDL_mutexP(thread_lock);
    88     SDL_LockMutex(thread_lock);
    89 
    89 
    90     /* Expand the list of threads, if necessary */
    90     /* Expand the list of threads, if necessary */
    91 #ifdef DEBUG_THREADS
    91 #ifdef DEBUG_THREADS
    92     printf("Adding thread (%d already - %d max)\n",
    92     printf("Adding thread (%d already - %d max)\n",
    93            SDL_numthreads, SDL_maxthreads);
    93            SDL_numthreads, SDL_maxthreads);
   116     int i;
   116     int i;
   117 
   117 
   118     if (!thread_lock) {
   118     if (!thread_lock) {
   119         return;
   119         return;
   120     }
   120     }
   121     SDL_mutexP(thread_lock);
   121     SDL_LockMutex(thread_lock);
   122     for (i = 0; i < SDL_numthreads; ++i) {
   122     for (i = 0; i < SDL_numthreads; ++i) {
   123         if (thread == SDL_Threads[i]) {
   123         if (thread == SDL_Threads[i]) {
   124             break;
   124             break;
   125         }
   125         }
   126     }
   126     }
   162     if (SDL_Threads) {
   162     if (SDL_Threads) {
   163         int i;
   163         int i;
   164         SDL_threadID this_thread;
   164         SDL_threadID this_thread;
   165 
   165 
   166         this_thread = SDL_ThreadID();
   166         this_thread = SDL_ThreadID();
   167         SDL_mutexP(thread_lock);
   167         SDL_LockMutex(thread_lock);
   168         for (i = 0; i < SDL_numthreads; ++i) {
   168         for (i = 0; i < SDL_numthreads; ++i) {
   169             if (this_thread == SDL_Threads[i]->threadid) {
   169             if (this_thread == SDL_Threads[i]->threadid) {
   170                 errbuf = &SDL_Threads[i]->errbuf;
   170                 errbuf = &SDL_Threads[i]->errbuf;
   171                 break;
   171                 break;
   172             }
   172             }