mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
kernel: start the semaphore wait timer after the early returns (#1173)
Wait() read the clock and looked up the thread id before checking for an available token. Both are only needed once the thread has to block.
This commit is contained in:
@@ -198,12 +198,6 @@ KernelSemaPrivate::Result KernelSemaPrivate::Wait(int need_count, uint32_t* ptr_
|
||||
infinitely = false;
|
||||
}
|
||||
|
||||
uint32_t elapsed = 0;
|
||||
Common::Timer t;
|
||||
t.Start();
|
||||
|
||||
int id = Common::Thread::GetThreadIdUnique();
|
||||
|
||||
if (m_count >= need_count) {
|
||||
m_count -= need_count;
|
||||
if (ptr_micros != nullptr) {
|
||||
@@ -216,6 +210,12 @@ KernelSemaPrivate::Result KernelSemaPrivate::Wait(int need_count, uint32_t* ptr_
|
||||
return Result::TimedOut;
|
||||
}
|
||||
|
||||
uint32_t elapsed = 0;
|
||||
Common::Timer t;
|
||||
t.Start();
|
||||
|
||||
int id = Common::Thread::GetThreadIdUnique();
|
||||
|
||||
WaitingThread waiter {};
|
||||
waiter.id = id;
|
||||
waiter.priority = (m_fifo_order ? 0 : Libs::LibKernel::PthreadGetCurrentPriorityForKernel());
|
||||
|
||||
Reference in New Issue
Block a user