artifact cache cancellation mutex -> semaphore (fixes cancellation thread on linux - we cannot take/drop across threads with mutexes); flip no_meta -> meta

This commit is contained in:
Ryan Fleury
2025-11-07 15:47:15 -08:00
parent 85778910c6
commit 4ea3c5a0e4
5 changed files with 32 additions and 39 deletions
+5 -5
View File
@@ -19,8 +19,7 @@ ac_init(void)
ac_shared->req_batches[idx].arena = arena_alloc();
}
ac_shared->cancel_thread = thread_launch(ac_cancel_thread_entry_point, 0);
ac_shared->cancel_thread_mutex = mutex_alloc();
mutex_take(ac_shared->cancel_thread_mutex);
ac_shared->cancel_thread_semaphore = semaphore_alloc(0, 1, str8_zero());
}
////////////////////////////////
@@ -218,7 +217,7 @@ ac_async_tick(void)
//
if(lane_idx() == 0)
{
mutex_drop(ac_shared->cancel_thread_mutex);
semaphore_drop(ac_shared->cancel_thread_semaphore);
}
//////////////////////////////
@@ -590,7 +589,7 @@ ac_async_tick(void)
//
if(lane_idx() == 0)
{
mutex_take(ac_shared->cancel_thread_mutex);
semaphore_take(ac_shared->cancel_thread_semaphore, max_U64);
}
scratch_end(scratch);
}
@@ -604,7 +603,7 @@ ac_cancel_thread_entry_point(void *p)
for(;;)
{
os_sleep_milliseconds(50);
MutexScope(ac_shared->cancel_thread_mutex)
semaphore_take(ac_shared->cancel_thread_semaphore, max_U64);
{
for EachIndex(cache_slot_idx, ac_shared->cache_slots_count)
{
@@ -650,5 +649,6 @@ ac_cancel_thread_entry_point(void *p)
}
}
}
semaphore_drop(ac_shared->cancel_thread_semaphore);
}
}
+1 -1
View File
@@ -129,7 +129,7 @@ struct AC_Shared
// rjf: cancel thread
Thread cancel_thread;
Mutex cancel_thread_mutex;
Semaphore cancel_thread_semaphore;
};
////////////////////////////////