sys_cond/lwcond: Fix waiting time in the debugger for mutex lock

This commit is contained in:
Eladash 2022-08-08 22:11:18 +03:00 committed by Ivan
parent f0002501f7
commit bc8bf2c329
2 changed files with 6 additions and 0 deletions

View File

@ -416,6 +416,8 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
{ {
if (lv2_obj::wait_timeout(timeout, &ppu)) if (lv2_obj::wait_timeout(timeout, &ppu))
{ {
const u64 start_time = ppu.start_time;
// Wait for rescheduling // Wait for rescheduling
if (ppu.check_state()) if (ppu.check_state())
{ {
@ -442,6 +444,7 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
} }
cond->mutex->sleep(ppu); cond->mutex->sleep(ppu);
ppu.start_time = start_time; // Restore start time because awake has been called
timeout = 0; timeout = 0;
continue; continue;
} }

View File

@ -443,6 +443,8 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
{ {
if (lv2_obj::wait_timeout(timeout, &ppu)) if (lv2_obj::wait_timeout(timeout, &ppu))
{ {
const u64 start_time = ppu.start_time;
// Wait for rescheduling // Wait for rescheduling
if (ppu.check_state()) if (ppu.check_state())
{ {
@ -476,6 +478,7 @@ error_code _sys_lwcond_queue_wait(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id
} }
mutex->sleep(ppu); mutex->sleep(ppu);
ppu.start_time = start_time; // Restore start time because awake has been called
timeout = 0; timeout = 0;
continue; continue;
} }