14 #include <system_error> 27 std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
47 template<
class TFn,
class... TArgs>
48 inline bool StartNewThread(std::thread *thr,
const char *name, TFn&& _Fx, TArgs&&... _Ax)
52 std::thread t([] (
const char *name, TFn&& F, TArgs&&... A) {
61 }, name, std::forward<TFn>(_Fx), std::forward<TArgs>(_Ax)...);
70 }
catch (
const std::system_error& e) {
72 DEBUG(misc, 1,
"Can't create thread '%s': %s", name, e.what());
Functions related to debugging.
void CSleep(int milliseconds)
Sleep on the current thread for a defined time.
bool StartNewThread(std::thread *thr, const char *name, TFn &&_Fx, TArgs &&... _Ax)
Start a new thread.
void SetCurrentThreadName(const char *name)
Name the thread this function is called on for the debugger.
#define DEBUG(name, level,...)
Output a line of debugging information.
Signal used for signalling we knowingly want to end the thread.