Implement thread_ctrl::scoped_priority

RAII priority control (+1, or -1)
This commit is contained in:
Nekotekina 2021-01-25 21:49:16 +03:00
parent a69248299d
commit ee288340b0
7 changed files with 26 additions and 11 deletions

View file

@ -281,6 +281,24 @@ public:
// Get current thread stack addr and size
static std::pair<void*, usz> get_thread_stack();
// Sets the native thread priority and returns it to zero at destructor
struct scoped_priority
{
explicit scoped_priority(int prio)
{
set_native_priority(prio);
}
scoped_priority(const scoped_priority&) = delete;
scoped_priority& operator=(const scoped_priority&) = delete;
~scoped_priority()
{
set_native_priority(0);
}
};
private:
// Miscellaneous
static const u64 process_affinity_mask;