Update name.c

This commit is contained in:
blueloveTH 2025-06-06 22:56:40 +08:00
parent a53af18ee8
commit da6c2b35bb

View File

@ -2,6 +2,7 @@
#include "pocketpy/common/name.h" #include "pocketpy/common/name.h"
#include "pocketpy/common/str.h" #include "pocketpy/common/str.h"
#include "pocketpy/common/threads.h"
#include "pocketpy/pocketpy.h" #include "pocketpy/pocketpy.h"
#include <stdatomic.h> #include <stdatomic.h>
@ -43,7 +44,7 @@ void pk_names_finalize() {
py_Name py_namev(c11_sv name) { py_Name py_namev(c11_sv name) {
while(atomic_flag_test_and_set(&pk_string_table.lock)) { while(atomic_flag_test_and_set(&pk_string_table.lock)) {
// busy-wait until the lock is released c11_thrd_yield();
} }
uint64_t hash = c11_sv__hash(name); uint64_t hash = c11_sv__hash(name);
int index = hash & 0xFFFF; int index = hash & 0xFFFF;