Core class that represents a thread.
More...
Inherits Id.
|
template<typename F > |
| Thread (F function) |
| Constructs a Thread object with a function. More...
|
|
template<typename F , typename... Args> |
| Thread (F function, Args &&... args) |
| Constructs a Thread object with a function and its parameters. More...
|
|
template<typename C > |
| Thread (void(C::*function)(), C *object) |
| Constructs a Thread object with a member function and its object. More...
|
|
| Thread (const Thread &)=delete |
|
| Thread (Thread &&other) noexcept=default |
|
| ~Thread () |
| Waits that the thread ends and then destroys this.
|
|
void | Detach () |
| Detaches the thread.
|
|
Id | GetId () const |
| Gets the id of the thread. More...
|
|
bool | IsJoinable () const |
| Checks whether the thread can be joined. More...
|
|
void | Join () |
| Waits that the thread ends. More...
|
|
void | SetName (const String &name) |
| Changes the debugging name associated to a thread. More...
|
|
Thread & | operator= (const Thread &)=delete |
|
Thread & | operator= (Thread &&thread) noexcept=default |
|
|
NAZARA_CORE_API friend bool | operator== (const Id &lhs, const Id &rhs) |
|
NAZARA_CORE_API friend bool | operator!= (const Id &lhs, const Id &rhs) |
|
NAZARA_CORE_API friend bool | operator< (const Id &lhs, const Id &rhs) |
|
NAZARA_CORE_API friend bool | operator<= (const Id &lhs, const Id &rhs) |
|
NAZARA_CORE_API friend bool | operator> (const Id &lhs, const Id &rhs) |
|
NAZARA_CORE_API friend bool | operator>= (const Id &lhs, const Id &rhs) |
|
NAZARA_CORE_API friend std::ostream & | operator<< (std::ostream &o, const Id &id) |
|
Core class that represents a thread.
◆ Thread() [1/3]
template<typename F >
Nz::Thread::Thread |
( |
F |
function | ) |
|
Constructs a Thread object with a function.
- Parameters
-
function | Task the thread will execute in parallel |
◆ Thread() [2/3]
template<typename F , typename... Args>
Nz::Thread::Thread |
( |
F |
function, |
|
|
Args &&... |
args |
|
) |
| |
Constructs a Thread object with a function and its parameters.
- Parameters
-
function | Task the thread will execute in parallel |
args | Arguments of the function |
◆ Thread() [3/3]
template<typename C >
Nz::Thread::Thread |
( |
void(C::*)() |
function, |
|
|
C * |
object |
|
) |
| |
Constructs a Thread object with a member function and its object.
- Parameters
-
function | Task the thread will execute in parallel |
object | Object on which the method will be called |
◆ GetId()
Thread::Id Nz::Thread::GetId |
( |
| ) |
const |
Gets the id of the thread.
- Returns
- The identifiant of the thread (PID)
◆ HardwareConcurrency()
unsigned int Nz::Thread::HardwareConcurrency |
( |
| ) |
|
|
static |
Gets the number of simulatenous threads that can run on the same cpu.
- Returns
- The number of simulatenous threads
◆ IsJoinable()
bool Nz::Thread::IsJoinable |
( |
| ) |
const |
Checks whether the thread can be joined.
- Returns
- true if well formed and not detached
◆ Join()
void Nz::Thread::Join |
( |
| ) |
|
Waits that the thread ends.
◆ SetCurrentThreadName()
void Nz::Thread::SetCurrentThreadName |
( |
const String & |
name | ) |
|
|
static |
Changes the debugging name associated to the calling thread.
Changes the debugging name associated with the calling thread, and may helps with debugging tools.
- Parameters
-
name | The new name associated with this thread |
- See also
- SetName
◆ SetName()
void Nz::Thread::SetName |
( |
const String & |
name | ) |
|
Changes the debugging name associated to a thread.
Changes the debugging name associated with a particular thread, and may helps with debugging tools.
- Parameters
-
name | The new name of the thread |
- See also
- SetCurrentThreadName
◆ Sleep()
void Nz::Thread::Sleep |
( |
UInt32 |
milliseconds | ) |
|
|
static |
Makes sleep this thread.
- Parameters
-
milliseconds | The number of milliseconds to sleep |
The documentation for this class was generated from the following files:
- include/Nazara/Core/Thread.hpp
- include/Nazara/Core/Thread.inl
- src/Nazara/Core/Thread.cpp