|
OpenTTD Source 20251117-master-g7398d2e290
|
Base of all threads. More...
#include "debug.h"#include "crashlog.h"#include "error_func.h"#include <system_error>#include <thread>#include <mutex>Go to the source code of this file.
Functions | |
| void | CSleep (int milliseconds) |
| Sleep on the current thread for a defined time. | |
| void | SetCurrentThreadName (const std::string &name) |
| Name the thread this function is called on for the debugger. | |
| template<class TFn , class... TArgs> | |
| bool | StartNewThread (std::thread *thr, std::string_view name, TFn &&_Fx, TArgs &&... _Ax) |
| Start a new thread. | |
Base of all threads.
Definition in file thread.h.
|
inline |
Sleep on the current thread for a defined time.
| milliseconds | Time to sleep for in milliseconds. |
Definition at line 24 of file thread.h.
Referenced by ClientNetworkGameSocketHandler::CloseConnection(), KillWait(), and SetAsyncSaveFinish().
| void SetCurrentThreadName | ( | const std::string & | name | ) |
Name the thread this function is called on for the debugger.
| name | Name to set for the thread.. |
Definition at line 245 of file unix.cpp.
Referenced by StartNewThread().
|
inline |
Start a new thread.
| TFn | Type of the function to call on the thread. |
| TArgs | Type of the parameters of the thread function. |
| thr | Pointer to a thread object; may be nullptr if a detached thread is wanted. |
| name | Name of the thread. |
| _Fx | Function to call on the thread. |
| _Ax | Arguments for the thread function. |
Definition at line 47 of file thread.h.
References Debug, CrashLog::InitThread(), lock, and SetCurrentThreadName().
Referenced by TCPConnecter::CheckActivity(), DoSave(), NetworkHTTPInitialize(), LinkGraphJob::SpawnThread(), MusicDriver_DMusic::Start(), and VideoDriver::StartGameThread().