mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-19 03:39:54 +00:00
sys_timer: weak_ptr -> shared_ptr
This commit is contained in:
parent
47436bd774
commit
33580e0aa1
@ -34,9 +34,9 @@ void lv2_timer_context::operator()()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const auto queue = port.lock())
|
if (port)
|
||||||
{
|
{
|
||||||
queue->send(source, data1, data2, next);
|
port->send(source, data1, data2, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (period)
|
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);
|
std::unique_lock lock(timer.mutex);
|
||||||
|
|
||||||
|
if (!lv2_event_queue::check(timer.port))
|
||||||
|
{
|
||||||
|
return CELL_ENOTCONN;
|
||||||
|
}
|
||||||
|
|
||||||
if (timer.state != SYS_TIMER_STATE_STOP)
|
if (timer.state != SYS_TIMER_STATE_STOP)
|
||||||
{
|
{
|
||||||
return CELL_EBUSY;
|
return CELL_EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timer.port.expired())
|
|
||||||
{
|
|
||||||
return CELL_ENOTCONN;
|
|
||||||
}
|
|
||||||
|
|
||||||
// sys_timer_start_periodic() will use current time (TODO: is it correct?)
|
// sys_timer_start_periodic() will use current time (TODO: is it correct?)
|
||||||
timer.expire = base_time ? base_time : start_time + period;
|
timer.expire = base_time ? base_time : start_time + period;
|
||||||
timer.period = period;
|
timer.period = period;
|
||||||
|
@ -30,7 +30,7 @@ struct lv2_timer_context : lv2_obj
|
|||||||
shared_mutex mutex;
|
shared_mutex mutex;
|
||||||
atomic_t<u32> state{SYS_TIMER_STATE_STOP};
|
atomic_t<u32> state{SYS_TIMER_STATE_STOP};
|
||||||
|
|
||||||
std::weak_ptr<lv2_event_queue> port;
|
std::shared_ptr<lv2_event_queue> port;
|
||||||
u64 source;
|
u64 source;
|
||||||
u64 data1;
|
u64 data1;
|
||||||
u64 data2;
|
u64 data2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user