mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
address_arbiter: Simplify GetThreadsWaitingOnAddress()
Simplifies the overall function and also allows for it to become a const-qualified member function.
This commit is contained in:
parent
8f8dda2d5b
commit
9f2c703137
2 changed files with 9 additions and 10 deletions
|
@ -228,15 +228,14 @@ void AddressArbiter::RemoveThread(std::shared_ptr<Thread> thread) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Thread>> AddressArbiter::GetThreadsWaitingOnAddress(VAddr address) {
|
std::vector<std::shared_ptr<Thread>> AddressArbiter::GetThreadsWaitingOnAddress(
|
||||||
std::vector<std::shared_ptr<Thread>> result;
|
VAddr address) const {
|
||||||
std::list<std::shared_ptr<Thread>>& thread_list = arb_threads[address];
|
const auto iter = arb_threads.find(address);
|
||||||
auto it = thread_list.begin();
|
if (iter == arb_threads.cend()) {
|
||||||
while (it != thread_list.end()) {
|
return {};
|
||||||
std::shared_ptr<Thread> current_thread = *it;
|
|
||||||
result.push_back(std::move(current_thread));
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
const std::list<std::shared_ptr<Thread>>& thread_list = iter->second;
|
||||||
|
return {thread_list.cbegin(), thread_list.cend()};
|
||||||
}
|
}
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -86,7 +86,7 @@ private:
|
||||||
void RemoveThread(std::shared_ptr<Thread> thread);
|
void RemoveThread(std::shared_ptr<Thread> thread);
|
||||||
|
|
||||||
// Gets the threads waiting on an address.
|
// Gets the threads waiting on an address.
|
||||||
std::vector<std::shared_ptr<Thread>> GetThreadsWaitingOnAddress(VAddr address);
|
std::vector<std::shared_ptr<Thread>> GetThreadsWaitingOnAddress(VAddr address) const;
|
||||||
|
|
||||||
/// List of threads waiting for a address arbiter
|
/// List of threads waiting for a address arbiter
|
||||||
std::unordered_map<VAddr, std::list<std::shared_ptr<Thread>>> arb_threads;
|
std::unordered_map<VAddr, std::list<std::shared_ptr<Thread>>> arb_threads;
|
||||||
|
|
Loading…
Reference in a new issue