(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.
This commit is contained in:
23
src/thread.h
23
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 */
|
||||
|
Reference in New Issue
Block a user