From 33580e0aa136c084e43e3739105cf33a6141128d Mon Sep 17 00:00:00 2001 From: Eladash Date: Fri, 14 May 2021 17:46:16 +0300 Subject: [PATCH] sys_timer: weak_ptr -> shared_ptr --- rpcs3/Emu/Cell/lv2/sys_timer.cpp | 14 +++++++------- rpcs3/Emu/Cell/lv2/sys_timer.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.cpp b/rpcs3/Emu/Cell/lv2/sys_timer.cpp index a26801dfd6..983403de9f 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_timer.cpp @@ -34,9 +34,9 @@ void lv2_timer_context::operator()() continue; } - if (const auto queue = port.lock()) + if (port) { - queue->send(source, data1, data2, next); + port->send(source, data1, data2, next); } if (period) @@ -151,16 +151,16 @@ error_code _sys_timer_start(ppu_thread& ppu, u32 timer_id, u64 base_time, u64 pe { std::unique_lock lock(timer.mutex); + if (!lv2_event_queue::check(timer.port)) + { + return CELL_ENOTCONN; + } + if (timer.state != SYS_TIMER_STATE_STOP) { return CELL_EBUSY; } - if (timer.port.expired()) - { - return CELL_ENOTCONN; - } - // sys_timer_start_periodic() will use current time (TODO: is it correct?) timer.expire = base_time ? base_time : start_time + period; timer.period = period; diff --git a/rpcs3/Emu/Cell/lv2/sys_timer.h b/rpcs3/Emu/Cell/lv2/sys_timer.h index 4b98f130e5..e9f17ae60c 100644 --- a/rpcs3/Emu/Cell/lv2/sys_timer.h +++ b/rpcs3/Emu/Cell/lv2/sys_timer.h @@ -30,7 +30,7 @@ struct lv2_timer_context : lv2_obj shared_mutex mutex; atomic_t state{SYS_TIMER_STATE_STOP}; - std::weak_ptr port; + std::shared_ptr port; u64 source; u64 data1; u64 data2;