fix: use _Atomic flag for sel_alloc_thread_id registration, move reg before loop, add wrong-thread guard test

This commit is contained in:
Rongsong Shen 2026-04-30 06:15:01 +00:00
parent b722e5cb3d
commit 1eb4eb1335
3 changed files with 61 additions and 13 deletions

View file

@ -117,16 +117,11 @@ int main(int argc, char* argv[])
INFO("xce scheduler is running");
/* Register this thread as the sole eval/GC allocator thread (write-once) */
sel_register_alloc_thread();
while (1) {
sched_update(&sched);
/* Register this thread as the sole eval/GC allocator thread (write-once) */
static int sel_thread_registered = 0;
if (!sel_thread_registered) {
sel_register_alloc_thread();
sel_thread_registered = 1;
}
sched_begin_session(&sched);
sched_go(&sched);