mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-01 19:48:11 +00:00
fix deadlocks on di_close contending with passive scoped dbgi access
This commit is contained in:
+11
-2
@@ -309,12 +309,19 @@ di_close(String8 path, U64 min_timestamp)
|
|||||||
if(node != 0)
|
if(node != 0)
|
||||||
{
|
{
|
||||||
node->ref_count -= 1;
|
node->ref_count -= 1;
|
||||||
if(node->ref_count == 0)
|
if(node->ref_count == 0) for(;;)
|
||||||
{
|
{
|
||||||
//- rjf: wait for touch count to go to 0
|
//- rjf: wait for touch count to go to 0
|
||||||
for(;ins_atomic_u64_eval(&node->touch_count) != 0;){}
|
if(ins_atomic_u64_eval(&node->touch_count) != 0)
|
||||||
|
{
|
||||||
|
os_rw_mutex_drop_w(stripe->rw_mutex);
|
||||||
|
for(U64 start_t = os_now_microseconds(); os_now_microseconds() <= start_t + 250;);
|
||||||
|
os_rw_mutex_take_w(stripe->rw_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
//- rjf: release
|
//- rjf: release
|
||||||
|
if(node->ref_count == 0 && ins_atomic_u64_eval(&node->touch_count) == 0)
|
||||||
|
{
|
||||||
di_string_release__stripe_mutex_w_guarded(stripe, node->path);
|
di_string_release__stripe_mutex_w_guarded(stripe, node->path);
|
||||||
if(node->file_base != 0)
|
if(node->file_base != 0)
|
||||||
{
|
{
|
||||||
@@ -334,6 +341,8 @@ di_close(String8 path, U64 min_timestamp)
|
|||||||
}
|
}
|
||||||
DLLRemove(slot->first, slot->last, node);
|
DLLRemove(slot->first, slot->last, node);
|
||||||
SLLStackPush(stripe->free_node, node);
|
SLLStackPush(stripe->free_node, node);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user