18 #ifndef ION_BASE_THREADSPAWNER_H_
19 #define ION_BASE_THREADSPAWNER_H_
45 const std::string&
GetName()
const {
return name_; }
57 const std::string name_;
69 #endif // ION_BASE_THREADSPAWNER_H_
bool(* ThreadFuncPtr)()
Thread types and constants.
const std::string & GetName() const
Returns the name of the thread supplied to the constructor.
A ThreadSpawner instance launches a new thread in its constructor and waits for the thread to finish ...
void Join()
Waits for the thread to finish.
~ThreadSpawner()
The destructor calls Join() to wait for the thread to finish.
port::ThreadId GetId() const
Returns the ThreadId for the thread.
std::function< bool()> ThreadStdFunc
pthread_t ThreadId
Defines a type that can be used to identify a thread.
ThreadSpawner(const std::string &name, port::ThreadFuncPtr func_ptr)
Creates a ThreadSpawner instance that runs the given function.