From 9046d4a5485452802b756869b7d27056ba9ea9d7 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 24 Nov 2019 20:15:51 -0500 Subject: kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154) * kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. - See https://github.com/citra-emu/citra/pull/4710 for details. --- src/core/hle/kernel/address_arbiter.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/hle/kernel/address_arbiter.cpp') diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index de0a9064e..4859954cb 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -21,7 +21,7 @@ namespace Kernel { namespace { // Wake up num_to_wake (or all) threads in a vector. -void WakeThreads(const std::vector>& waiting_threads, s32 num_to_wake) { +void WakeThreads(const std::vector>& waiting_threads, s32 num_to_wake) { auto& system = Core::System::GetInstance(); // Only process up to 'target' threads, unless 'target' is <= 0, in which case process // them all. @@ -59,7 +59,8 @@ ResultCode AddressArbiter::SignalToAddress(VAddr address, SignalType type, s32 v } ResultCode AddressArbiter::SignalToAddressOnly(VAddr address, s32 num_to_wake) { - const std::vector> waiting_threads = GetThreadsWaitingOnAddress(address); + const std::vector> waiting_threads = + GetThreadsWaitingOnAddress(address); WakeThreads(waiting_threads, num_to_wake); return RESULT_SUCCESS; } @@ -87,7 +88,8 @@ ResultCode AddressArbiter::ModifyByWaitingCountAndSignalToAddressIfEqual(VAddr a } // Get threads waiting on the address. - const std::vector> waiting_threads = GetThreadsWaitingOnAddress(address); + const std::vector> waiting_threads = + GetThreadsWaitingOnAddress(address); // Determine the modified value depending on the waiting count. s32 updated_value; @@ -172,21 +174,21 @@ ResultCode AddressArbiter::WaitForAddressIfEqual(VAddr address, s32 value, s64 t } ResultCode AddressArbiter::WaitForAddressImpl(VAddr address, s64 timeout) { - SharedPtr current_thread = system.CurrentScheduler().GetCurrentThread(); + Thread* current_thread = system.CurrentScheduler().GetCurrentThread(); current_thread->SetArbiterWaitAddress(address); current_thread->SetStatus(ThreadStatus::WaitArb); current_thread->InvalidateWakeupCallback(); - current_thread->WakeAfterDelay(timeout); system.PrepareReschedule(current_thread->GetProcessorID()); return RESULT_TIMEOUT; } -std::vector> AddressArbiter::GetThreadsWaitingOnAddress(VAddr address) const { +std::vector> AddressArbiter::GetThreadsWaitingOnAddress( + VAddr address) const { // Retrieve all threads that are waiting for this address. - std::vector> threads; + std::vector> threads; const auto& scheduler = system.GlobalScheduler(); const auto& thread_list = scheduler.GetThreadList(); @@ -198,7 +200,7 @@ std::vector> AddressArbiter::GetThreadsWaitingOnAddress(VAddr // Sort them by priority, such that the highest priority ones come first. std::sort(threads.begin(), threads.end(), - [](const SharedPtr& lhs, const SharedPtr& rhs) { + [](const std::shared_ptr& lhs, const std::shared_ptr& rhs) { return lhs->GetPriority() < rhs->GetPriority(); }); -- cgit v1.2.3