(svn r2908) If threaded saving fails or does not happen, sending subsequent messages might hang ottd. So don't send them :)

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
Darkvater 19 years ago
parent d05f504c01
commit 92270500e9

@ -1283,6 +1283,8 @@ void SaveFileError(void)
SaveFileDone(); SaveFileDone();
} }
static Thread* save_thread;
/** We have written the whole game into memory, _save_pool, now find /** We have written the whole game into memory, _save_pool, now find
* and appropiate compressor and start writing to file. * and appropiate compressor and start writing to file.
*/ */
@ -1294,7 +1296,7 @@ static void* SaveFileToDisk(void *arg)
static byte *tmp = NULL; static byte *tmp = NULL;
uint32 hdr[2]; uint32 hdr[2];
OTTD_SendThreadMessage(MSG_OTTD_SAVETHREAD_START); if (save_thread != NULL) OTTD_SendThreadMessage(MSG_OTTD_SAVETHREAD_START);
tmp = _sl.buf; tmp = _sl.buf;
@ -1341,13 +1343,10 @@ static void* SaveFileToDisk(void *arg)
GetSavegameFormat("memory")->uninit_write(); // clean the memorypool GetSavegameFormat("memory")->uninit_write(); // clean the memorypool
fclose(_sl.fh); fclose(_sl.fh);
OTTD_SendThreadMessage(MSG_OTTD_SAVETHREAD_DONE); if (save_thread != NULL) OTTD_SendThreadMessage(MSG_OTTD_SAVETHREAD_DONE);
return NULL; return NULL;
} }
static Thread* save_thread;
void WaitTillSaved(void) void WaitTillSaved(void)
{ {
OTTDJoinThread(save_thread); OTTDJoinThread(save_thread);

Loading…
Cancel
Save