A native OS thread.
More...
#include <Threading.h>
A native OS thread.
Example:
Thread thread;
thread.start([](Thread& thread)
{
thread.setThreadName(SC_NATIVE_STR("My Thread"));
});
thread.join();
thread.detach();
static void Sleep(uint32_t milliseconds)
Puts current thread to sleep.
- 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 |
Check if thread has been started.
- Returns
true
if thread has been started
The documentation for this struct was generated from the following file: