summaryrefslogtreecommitdiff
path: root/src/thread.h
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.h
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.h')
-rw-r--r--src/thread.h23
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 */