Should fix possible error where game can hang for prolonged time on

exit.
This commit is contained in:
Themaister 2011-02-11 19:54:42 +01:00
parent d039bedad4
commit 1eea7786bc

View File

@ -62,7 +62,8 @@ static int autosave_thread(void *data)
}
SDL_mutexP(save->cond_lock);
SDL_CondWaitTimeout(save->cond, save->cond_lock, save->interval * 1000);
if (!save->quit)
SDL_CondWaitTimeout(save->cond, save->cond_lock, save->interval * 1000);
SDL_mutexV(save->cond_lock);
}
@ -108,7 +109,9 @@ void autosave_unlock(autosave_t *handle)
void autosave_free(autosave_t *handle)
{
SDL_mutexP(handle->cond_lock);
handle->quit = true;
SDL_mutexV(handle->cond_lock);
SDL_CondSignal(handle->cond);
SDL_WaitThread(handle->thread, NULL);