summaryrefslogtreecommitdiff
path: root/src/thread_none.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-20 03:44:43 +0000
committerrubidium <rubidium@openttd.org>2009-01-20 03:44:43 +0000
commit6a3aaef4868ed0812a569c1a048a6511dac80ba7 (patch)
tree9998eb5852e48d00ab69b2684a14c266b28117b4 /src/thread_none.cpp
parentbb770717494ec94d54edb4c1dd1f5a7a0c830ead (diff)
downloadopenttd-6a3aaef4868ed0812a569c1a048a6511dac80ba7.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_none.cpp')
-rw-r--r--src/thread_none.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/thread_none.cpp b/src/thread_none.cpp
index 34f8ca1ff..f0863efaf 100644
--- a/src/thread_none.cpp
+++ b/src/thread_none.cpp
@@ -10,3 +10,15 @@
if (thread != NULL) *thread = NULL;
return false;
}
+
+/** Mutex that doesn't do locking because it ain't needed when there're no threads */
+class ThreadMutex_None : ThreadMutex {
+public:
+ virtual void BeginCritical() {}
+ virtual void EndCritical() {}
+};
+
+/* static */ ThreadMutex *ThreadMutex::New()
+{
+ return new ThreadMutex_None;
+}