A native OS thread.
More...
#include <Threading.h>
A native OS thread.
Example:
{
});
A native OS thread.
Definition Threading.h:118
static void Sleep(uint32_t milliseconds)
Puts current thread to sleep.
Result start(Function< void(Thread &)> &&func)
Starts the new thread with given name and func.
void setThreadName(const native_char_t *name)
Sets current thread name ONLY if called from inside the thread.
Result detach()
Detaches the thread so that its resources are automatically released back to the system without Threa...
Result join()
Waits for thread to finish and releases its resources.
- Warning
- Thread destructor will assert if SC::Thread::detach() or SC::Thread::join() has not been called.
◆ CurrentThreadID()
static uint64_t SC::Thread::CurrentThreadID |
( |
| ) |
|
|
static |
Returns thread id of the thread calling the function.
- Returns
- thread id
◆ detach()
Detaches the thread so that its resources are automatically released back to the system without Thread::join.
- Returns
- Valid Result if thread has been detached
◆ join()
Waits for thread to finish and releases its resources.
- Returns
- Valid Result if thread has finished
◆ setThreadName()
Sets current thread name ONLY if called from inside the thread.
- Parameters
-
name | The name of the thread |
- Warning
- This function will ASSERT if it's not called from the thread itself.
◆ Sleep()
static void SC::Thread::Sleep |
( |
uint32_t | milliseconds | ) |
|
|
static |
Puts current thread to sleep.
- Parameters
-
milliseconds | Sleep for given number of milliseconds |
◆ start()
Starts the new thread with given name and func.
- Parameters
-
func | Function running on thread. Must be a valid pointer to action for the entire duration of thread. |
◆ threadID()
Returns thread id of this thread object (not current thread)
◆ wasStarted()
bool SC::Thread::wasStarted |
( |
| ) |
const |
|
nodiscard |
Check if thread has been started.
- Returns
true
if thread has been started
The documentation for this struct was generated from the following file: