mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
fix bad wait condition in ctrl memory cache accessing
This commit is contained in:
+7
-17
@@ -1652,7 +1652,6 @@ ctrl_key_from_process_vaddr_range(CTRL_Handle process, Rng1U64 vaddr_range, B32
|
||||
//- rjf: loop: try to look for current results, request if not there, wait if we can, repeat until we can't
|
||||
U64 mem_gen = ctrl_mem_gen();
|
||||
B32 key_is_stale = 0;
|
||||
B32 requested = 0;
|
||||
for(;;)
|
||||
{
|
||||
//- rjf: step 1: [read-only] try to look for current results for key's ID
|
||||
@@ -1693,7 +1692,8 @@ ctrl_key_from_process_vaddr_range(CTRL_Handle process, Rng1U64 vaddr_range, B32
|
||||
|
||||
//- rjf: step 3: if the ID does not exist in the process' cache, then we
|
||||
// need to build a node for it. if that, or if the ID is stale, then also
|
||||
// request that that range is streamed.
|
||||
// request that that range is streamed & wait for its result (for as long
|
||||
// as we have.)
|
||||
if(!id_exists || (id_exists && id_stale && !id_working))
|
||||
{
|
||||
B32 node_needs_stream = 0;
|
||||
@@ -1737,15 +1737,15 @@ ctrl_key_from_process_vaddr_range(CTRL_Handle process, Rng1U64 vaddr_range, B32
|
||||
}
|
||||
}
|
||||
}
|
||||
if(node_needs_stream)
|
||||
if(node_needs_stream) OS_MutexScopeR(process_stripe->rw_mutex)
|
||||
{
|
||||
if(ctrl_u2ms_enqueue_req(key, process, vaddr_range, zero_terminated, endt_us))
|
||||
{
|
||||
async_push_work(ctrl_mem_stream_work, .working_counter = node_working_count);
|
||||
requested = 1;
|
||||
os_condition_variable_wait_rw_r(process_stripe->cv, process_stripe->rw_mutex, endt_us);
|
||||
id_working = 1;
|
||||
}
|
||||
else OS_MutexScopeR(process_stripe->rw_mutex)
|
||||
else
|
||||
{
|
||||
for(CTRL_ProcessMemoryCacheNode *process_n = process_slot->first; process_n != 0; process_n = process_n->next)
|
||||
{
|
||||
@@ -1768,21 +1768,11 @@ ctrl_key_from_process_vaddr_range(CTRL_Handle process, Rng1U64 vaddr_range, B32
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: step 4: if we have no time to wait, then abort; if we submitted a
|
||||
// request, but the work is done and we have no results, then abort;
|
||||
// otherwise, wait on this process' stripe
|
||||
if(os_now_microseconds() >= endt_us)
|
||||
//- rjf: step 4: if we have no time to wait, or no results & no progress, then abort
|
||||
if(os_now_microseconds() >= endt_us || !id_working)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if(!id_working)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else OS_MutexScopeR(process_stripe->rw_mutex)
|
||||
{
|
||||
os_condition_variable_wait_rw_r(process_stripe->cv, process_stripe->rw_mutex, endt_us);
|
||||
}
|
||||
}
|
||||
if(out_is_stale)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user