mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-23 04:41:12 +00:00
kern: fix bug in SvcSetThreadPriority
This commit is contained in:
parent
94f9cc1626
commit
5b8a20dbf7
3 changed files with 17 additions and 1 deletions
|
@ -347,8 +347,10 @@ namespace ams::kern {
|
|||
constexpr s32 GetIdealCore() const { return this->ideal_core_id; }
|
||||
constexpr s32 GetActiveCore() const { return this->core_id; }
|
||||
constexpr void SetActiveCore(s32 core) { this->core_id = core; }
|
||||
|
||||
constexpr s32 GetPriority() const { return this->priority; }
|
||||
constexpr void SetPriority(s32 prio) { this->priority = prio; }
|
||||
|
||||
constexpr s32 GetBasePriority() const { return this->base_priority; }
|
||||
|
||||
constexpr QueueEntry &GetPriorityQueueEntry(s32 core) { return this->per_core_priority_queue_entry[core]; }
|
||||
|
@ -438,6 +440,7 @@ namespace ams::kern {
|
|||
|
||||
void Wakeup();
|
||||
|
||||
void SetBasePriority(s32 priority);
|
||||
Result SetPriorityToIdle();
|
||||
|
||||
Result Run();
|
||||
|
|
|
@ -384,6 +384,19 @@ namespace ams::kern {
|
|||
}
|
||||
}
|
||||
|
||||
void KThread::SetBasePriority(s32 priority) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
MESOSPHERE_ASSERT(ams::svc::HighestThreadPriority <= priority && priority <= ams::svc::LowestThreadPriority);
|
||||
|
||||
KScopedSchedulerLock sl;
|
||||
|
||||
/* Change our base priority. */
|
||||
this->base_priority = priority;
|
||||
|
||||
/* Perform a priority restoration. */
|
||||
RestorePriority(this);
|
||||
}
|
||||
|
||||
Result KThread::SetPriorityToIdle() {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace ams::kern::svc {
|
|||
R_UNLESS(thread.IsNotNull(), svc::ResultInvalidHandle());
|
||||
|
||||
/* Set the thread priority. */
|
||||
thread->SetPriority(priority);
|
||||
thread->SetBasePriority(priority);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue