diff options
author | rubidium <rubidium@openttd.org> | 2009-01-20 03:44:43 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-20 03:44:43 +0000 |
commit | 82e98c2188b5e449384b6aa07442001aa62bed01 (patch) | |
tree | 9998eb5852e48d00ab69b2684a14c266b28117b4 /src/thread.h | |
parent | 202aeb83065fa543142a1ae4889fc3d310d9cba4 (diff) | |
download | openttd-82e98c2188b5e449384b6aa07442001aa62bed01.tar.xz |
(svn r15159) -Fix: move the UDP queries that resolve a hostname into threads so they don't freeze OpenTTD when for example the network connection got severed. Thanks to glx for writing the mutex implementation for Windows.
Diffstat (limited to 'src/thread.h')
-rw-r--r-- | src/thread.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/thread.h b/src/thread.h index 71041e9d7..8225df7d0 100644 --- a/src/thread.h +++ b/src/thread.h @@ -40,4 +40,27 @@ public: static bool New(OTTDThreadFunc proc, void *param, ThreadObject **thread = NULL); }; +/** + * Cross-platform Mutex + */ +class ThreadMutex { +public: + static ThreadMutex *New(); + + /** + * Virtual Destructor to avoid compiler warnings. + */ + virtual ~ThreadMutex() {}; + + /** + * Begin the critical section + */ + virtual void BeginCritical() = 0; + + /** + * End of the critical section + */ + virtual void EndCritical() = 0; +}; + #endif /* THREAD_H */ |