28 static bool NamingThreadFunc(
const std::string&
name,
40 func_(func_ptr ? std::bind(NamingThreadFunc, name,
49 func_(std::bind(NamingThreadFunc, name, func)),
58 if (id_ != port::kInvalidThreadId) {
60 id_ = port::kInvalidThreadId;
69 return port::kInvalidThreadId;
bool(* ThreadFuncPtr)()
Thread types and constants.
bool JoinThread(ThreadId id)
Windows-specific public functions.
void Join()
Waits for the thread to finish.
ThreadId SpawnThreadStd(const ThreadStdFunc *func)
~ThreadSpawner()
The destructor calls Join() to wait for the thread to finish.
std::function< bool()> ThreadStdFunc
bool IsThreadNamingSupported()
Thread naming functions.
pthread_t ThreadId
Defines a type that can be used to identify a thread.
bool SetThreadName(const std::string &name)
Sets the name of the current thread.
ThreadSpawner(const std::string &name, port::ThreadFuncPtr func_ptr)
Creates a ThreadSpawner instance that runs the given function.