1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +00:00

(svn r5977) -Fix [FS#78]: never set I-am-a-thread bool to true IN the thread. Machines with

dualcore can be faster then you want, and therefor create 2 threads, while
  you made the bool to make sure there is never more then 1 thread of this type.
This commit is contained in:
truelight
2006-08-20 13:39:33 +00:00
parent e159ada7a2
commit a06d5548eb
3 changed files with 8 additions and 9 deletions

View File

@@ -1402,8 +1402,6 @@ static void* SaveFileToDisk(void *arg)
const SaveLoadFormat *fmt;
uint32 hdr[2];
if (arg != NULL) OTTD_SendThreadMessage(MSG_OTTD_SAVETHREAD_START);
/* XXX - Setup setjmp error handler if an error occurs anywhere deep during
* loading/saving execute a longjmp() and continue execution here */
if (setjmp(_sl.excpt)) {
@@ -1536,10 +1534,12 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode)
SlSaveChunks();
SlWriteFill(); // flush the save buffer
SaveFileStart();
if (_network_server ||
(save_thread = OTTDCreateThread(&SaveFileToDisk, (void*)"")) == NULL) {
DEBUG(misc, 1) ("[Sl] Cannot create savegame thread, reverting to single-threaded mode...");
SaveFileToDisk(NULL);
SaveFileDone();
}
} else { /* LOAD game */