diff options
author | truelight <truelight@openttd.org> | 2006-08-20 13:39:33 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-20 13:39:33 +0000 |
commit | fb76d2530a804a3bf6339ef1e6827796d149d069 (patch) | |
tree | 2f784ed7fc2f9f935ddaf767abefd0e0aa5a4099 /openttd.c | |
parent | b7a3352009d68bc332d29a32854626e0c532eb34 (diff) | |
download | openttd-fb76d2530a804a3bf6339ef1e6827796d149d069.tar.xz |
(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.
Diffstat (limited to 'openttd.c')
-rw-r--r-- | openttd.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -535,9 +535,9 @@ int ttd_main(int argc, char *argv[]) /** Mutex so that only one thread can communicate with the main program * at any given time */ -static ThreadMsg _message = 0; +static ThreadMsg _message = MSG_OTTD_NO_MESSAGE; -static inline void OTTD_ReleaseMutex(void) {_message = 0;} +static inline void OTTD_ReleaseMutex(void) {_message = MSG_OTTD_NO_MESSAGE;} static inline ThreadMsg OTTD_PollThreadEvent(void) {return _message;} /** Called by running thread to execute some action in the main game. @@ -545,7 +545,7 @@ static inline ThreadMsg OTTD_PollThreadEvent(void) {return _message;} void OTTD_SendThreadMessage(ThreadMsg msg) { if (_exit_game) return; - while (_message != 0) CSleep(10); + while (_message != MSG_OTTD_NO_MESSAGE) CSleep(10); _message = msg; } @@ -557,7 +557,6 @@ void OTTD_SendThreadMessage(ThreadMsg msg) static void ProcessSentMessage(ThreadMsg message) { switch (message) { - case MSG_OTTD_SAVETHREAD_START: SaveFileStart(); break; case MSG_OTTD_SAVETHREAD_DONE: SaveFileDone(); break; case MSG_OTTD_SAVETHREAD_ERROR: SaveFileError(); break; default: NOT_REACHED(); |