|
ReXGlue SDK
|
#include <rex/platform/thread.h>
Classes | |
| struct | CreationParameters |
Public Types | |
| using | RedirectFilter = bool (*)(u64 pc, void* context) |
Public Member Functions | |
| virtual u32 | GetSystemID () const =0 |
| const std::string & | GetName () const |
| virtual void | SetName (std::string name) |
| virtual i32 | GetPriority ()=0 |
| virtual void | SetPriority (i32 new_priority)=0 |
| virtual u64 | GetAffinityMask ()=0 |
| virtual void | SetAffinityMask (u64 new_affinity_mask)=0 |
| virtual void | QueueUserCallback (rex::MoveOnlyFunction< void()> callback)=0 |
| virtual bool | Resume (u32 *out_previous_suspend_count=nullptr)=0 |
| virtual bool | Suspend (u32 *out_previous_suspend_count=nullptr)=0 |
| virtual bool | Redirect (RedirectFilter filter, void *context, void(*target)())=0 |
| virtual bool | SuspendIf (RedirectFilter filter, void *context)=0 |
| Public Member Functions inherited from rex::platform::WaitHandle | |
| virtual void * | GetNativeHandle () const =0 |
Static Public Member Functions | |
| static std::unique_ptr< Thread > | Create (CreationParameters params, rex::MoveOnlyFunction< void()> start_routine) |
| static Thread * | GetCallingThread () |
| static void | Exit (int exit_code) |
Protected Attributes | |
| std::string | name_ |
Thread object modeled on the Win32 thread.
| using rex::platform::Thread::RedirectFilter = bool (*)(u64 pc, void* context) |
Decides whether a stopped thread is acted on.
| pc | The instruction pointer of the stopped thread. |
| context | The context passed to Redirect or SuspendIf. |
|
static |
Creates a thread that runs start_routine.
|
static |
Ends the calling thread without running destructors, signaling the thread object. Does not return.
|
pure virtual |
Returns the processor affinity mask. The mask has one bit per logical processor the thread may run on.
|
static |
Returns the Thread object of the calling thread, wrapping threads Create did not start.
|
pure virtual |
Queues a user callback. Callbacks run in FIFO order when the thread enters an alertable wait, which then returns WaitResult::kUserCallback.
|
pure virtual |
Makes the thread call target in place of its current instruction when filter accepts it. Filter runs while the thread is stopped, so it must not lock or allocate.
| filter | Called with the instruction pointer of the stopped thread. |
| target | Called on the thread. It never returns. |
|
pure virtual |
Decrements the suspend count. The thread runs again at 0.
| out_previous_suspend_count | Receives the previous count, may be null. |
|
pure virtual |
Sets the processor affinity mask, a subset of the process affinity mask.
| new_affinity_mask | 1 bit per logical processor the thread may run on. |
|
inlinevirtual |
Names the thread for debuggers and logs.
|
pure virtual |
Sets the thread priority.
| new_priority | Usually a ThreadPriority value. |
|
pure virtual |
Increments the suspend count and suspends the thread.
| out_previous_suspend_count | Receives the previous count, may be null. |
|
pure virtual |
Suspends the thread when filter accepts its current instruction. Filter runs while the thread is stopped, so it must not lock or allocate.
| filter | Called with the instruction pointer of the stopped thread. |