Merge branch 'master' into jgrpp
This commit is contained in:
@@ -11,16 +11,13 @@
|
||||
#define THREAD_H
|
||||
|
||||
#include "debug.h"
|
||||
#include "crashlog.h"
|
||||
#include <system_error>
|
||||
#include <thread>
|
||||
#if defined(__MINGW32__)
|
||||
#include "3rdparty/mingw-std-threads/mingw.thread.h"
|
||||
#endif
|
||||
|
||||
/** Signal used for signalling we knowingly want to end the thread. */
|
||||
class OTTDThreadExitSignal { };
|
||||
|
||||
|
||||
/**
|
||||
* Sleep on the current thread for a defined time.
|
||||
* @param milliseconds Time to sleep for in milliseconds.
|
||||
@@ -88,10 +85,10 @@ inline bool StartNewThread(std::thread *thr, const char *name, TFn&& _Fx, TArgs&
|
||||
std::thread t([] (const char *name, TFn&& F, TArgs&&... A) {
|
||||
SetCurrentThreadName(name);
|
||||
PerThreadSetup();
|
||||
CrashLog::InitThread();
|
||||
try {
|
||||
/* Call user function with the given arguments. */
|
||||
F(A...);
|
||||
} catch (OTTDThreadExitSignal&) {
|
||||
} catch (...) {
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
Reference in New Issue
Block a user