mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat Add atomic_t<>::try_inc GDBDebugServer is broken (needs rewrite) Removed old_thread class (former named_thread) Removed storing/rethrowing exceptions from thread Emu.Stop doesn't inject an exception anymore task_stack helper class removed thread_base simplified (no shared_from_this) thread_ctrl::spawn simplified (creates detached thread) Implemented overrideable thread detaching logic Disabled cellAdec, cellDmux, cellFsAio SPUThread renamed to spu_thread RawSPUThread removed, spu_thread used instead Disabled deriving from ppu_thread Partial support for thread renaming lv2_timer... simplified, screw it idm/fxm: butchered support for on_stop/on_init vm: improved allocation structure (added size)
This commit is contained in:
parent
8ca6c9fff0
commit
1b37e775be
82 changed files with 1820 additions and 2023 deletions
|
|
@ -11,13 +11,11 @@
|
|||
|
||||
#include <thread>
|
||||
|
||||
|
||||
|
||||
LOG_CHANNEL(sys_timer);
|
||||
|
||||
extern u64 get_system_time();
|
||||
|
||||
void lv2_timer::on_task()
|
||||
void lv2_timer_context::operator()()
|
||||
{
|
||||
while (!Emu.IsStopped())
|
||||
{
|
||||
|
|
@ -50,7 +48,6 @@ void lv2_timer::on_task()
|
|||
}
|
||||
|
||||
// TODO: use single global dedicated thread for busy waiting, no timer threads
|
||||
lv2_obj::sleep_timeout(*this, next - _now);
|
||||
thread_ctrl::wait_for(next - _now);
|
||||
}
|
||||
else if (_state == SYS_TIMER_STATE_STOP)
|
||||
|
|
@ -64,19 +61,17 @@ void lv2_timer::on_task()
|
|||
}
|
||||
}
|
||||
|
||||
void lv2_timer::on_stop()
|
||||
void lv2_timer_context::on_abort()
|
||||
{
|
||||
// Signal thread using invalid state
|
||||
state = -1;
|
||||
notify();
|
||||
join();
|
||||
}
|
||||
|
||||
error_code sys_timer_create(vm::ptr<u32> timer_id)
|
||||
{
|
||||
sys_timer.warning("sys_timer_create(timer_id=*0x%x)", timer_id);
|
||||
|
||||
if (const u32 id = idm::make<lv2_obj, lv2_timer>())
|
||||
if (const u32 id = idm::make<lv2_obj, lv2_timer>("Timer Thread"))
|
||||
{
|
||||
*timer_id = id;
|
||||
return CELL_OK;
|
||||
|
|
@ -155,7 +150,7 @@ error_code _sys_timer_start(u32 timer_id, u64 base_time, u64 period)
|
|||
|
||||
const auto timer = idm::check<lv2_obj, lv2_timer>(timer_id, [&](lv2_timer& timer) -> CellError
|
||||
{
|
||||
std::lock_guard lock(timer.mutex);
|
||||
std::unique_lock lock(timer.mutex);
|
||||
|
||||
if (timer.state != SYS_TIMER_STATE_STOP)
|
||||
{
|
||||
|
|
@ -171,7 +166,9 @@ error_code _sys_timer_start(u32 timer_id, u64 base_time, u64 period)
|
|||
timer.expire = base_time ? base_time : start_time + period;
|
||||
timer.period = period;
|
||||
timer.state = SYS_TIMER_STATE_RUN;
|
||||
timer.notify();
|
||||
|
||||
lock.unlock();
|
||||
thread_ctrl::notify(timer);
|
||||
return {};
|
||||
});
|
||||
|
||||
|
|
@ -311,6 +308,11 @@ error_code sys_timer_usleep(ppu_thread& ppu, u64 sleep_time)
|
|||
|
||||
while (sleep_time >= passed)
|
||||
{
|
||||
if (ppu.is_stopped())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
remaining = sleep_time - passed;
|
||||
|
||||
if (remaining > host_min_quantum)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue