define synchronization primitive interface in base layer, implement using os layer; convert all usage -> base layer; use base sync primitives in lane tctx info

This commit is contained in:
Ryan Fleury
2025-08-18 10:46:43 -07:00
parent a48651471d
commit c33dd2869a
49 changed files with 1454 additions and 1293 deletions
+8 -8
View File
@@ -21,13 +21,13 @@ geo_init(void)
for(U64 idx = 0; idx < geo_shared->stripes_count; idx += 1)
{
geo_shared->stripes[idx].arena = arena_alloc();
geo_shared->stripes[idx].rw_mutex = os_rw_mutex_alloc();
geo_shared->stripes[idx].cv = os_condition_variable_alloc();
geo_shared->stripes[idx].rw_mutex = rw_mutex_alloc();
geo_shared->stripes[idx].cv = cond_var_alloc();
}
geo_shared->u2x_ring_size = KB(64);
geo_shared->u2x_ring_base = push_array_no_zero(arena, U8, geo_shared->u2x_ring_size);
geo_shared->u2x_ring_cv = os_condition_variable_alloc();
geo_shared->u2x_ring_mutex = os_mutex_alloc();
geo_shared->u2x_ring_cv = cond_var_alloc();
geo_shared->u2x_ring_mutex = mutex_alloc();
geo_shared->evictor_thread = os_thread_launch(geo_evictor_thread__entry_point, 0, 0);
}
@@ -217,11 +217,11 @@ geo_u2x_enqueue_req(U128 hash, U64 endt_us)
{
break;
}
os_condition_variable_wait(geo_shared->u2x_ring_cv, geo_shared->u2x_ring_mutex, endt_us);
cond_var_wait(geo_shared->u2x_ring_cv, geo_shared->u2x_ring_mutex, endt_us);
}
if(good)
{
os_condition_variable_broadcast(geo_shared->u2x_ring_cv);
cond_var_broadcast(geo_shared->u2x_ring_cv);
}
return good;
}
@@ -237,9 +237,9 @@ geo_u2x_dequeue_req(U128 *hash_out)
geo_shared->u2x_ring_read_pos += ring_read_struct(geo_shared->u2x_ring_base, geo_shared->u2x_ring_size, geo_shared->u2x_ring_read_pos, hash_out);
break;
}
os_condition_variable_wait(geo_shared->u2x_ring_cv, geo_shared->u2x_ring_mutex, max_U64);
cond_var_wait(geo_shared->u2x_ring_cv, geo_shared->u2x_ring_mutex, max_U64);
}
os_condition_variable_broadcast(geo_shared->u2x_ring_cv);
cond_var_broadcast(geo_shared->u2x_ring_cv);
}
ASYNC_WORK_DEF(geo_xfer_work)
+4 -4
View File
@@ -32,8 +32,8 @@ typedef struct GEO_Stripe GEO_Stripe;
struct GEO_Stripe
{
Arena *arena;
OS_Handle rw_mutex;
OS_Handle cv;
RWMutex rw_mutex;
CondVar cv;
};
////////////////////////////////
@@ -84,8 +84,8 @@ struct GEO_Shared
U8 *u2x_ring_base;
U64 u2x_ring_write_pos;
U64 u2x_ring_read_pos;
OS_Handle u2x_ring_cv;
OS_Handle u2x_ring_mutex;
CondVar u2x_ring_cv;
Mutex u2x_ring_mutex;
// rjf: evictor thread
OS_Handle evictor_thread;