src/thread/SDL_thread.c
changeset 340 b9f1ce709960
parent 329 1d74ddc90cb2
child 397 283d348cb624
equal deleted inserted replaced
339:eed579d059ef 340:b9f1ce709960
   144 			if ( thread == SDL_Threads[i] ) {
   144 			if ( thread == SDL_Threads[i] ) {
   145 				break;
   145 				break;
   146 			}
   146 			}
   147 		}
   147 		}
   148 		if ( i < SDL_numthreads ) {
   148 		if ( i < SDL_numthreads ) {
   149 			--SDL_numthreads;
   149 			if ( --SDL_numthreads > 0 ) {
   150 			while ( i < SDL_numthreads ) {
   150 				while ( i < SDL_numthreads ) {
   151 				SDL_Threads[i] = SDL_Threads[i+1];
   151 					SDL_Threads[i] = SDL_Threads[i+1];
   152 				++i;
   152 					++i;
       
   153 				}
       
   154 			} else {
       
   155 				SDL_maxthreads = 0;
       
   156 				free(SDL_Threads);
       
   157 				SDL_Threads = NULL;
   153 			}
   158 			}
   154 #ifdef DEBUG_THREADS
   159 #ifdef DEBUG_THREADS
   155 			printf("Deleting thread (%d left - %d max)\n",
   160 			printf("Deleting thread (%d left - %d max)\n",
   156 					SDL_numthreads, SDL_maxthreads);
   161 					SDL_numthreads, SDL_maxthreads);
   157 #endif
   162 #endif