mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 20:10:17 +00:00
fix all
This commit is contained in:
parent
785bb6841e
commit
6b80817a98
@ -4,6 +4,8 @@
|
||||
#include "http/HttpMessage.h"
|
||||
#include "base/hplatform.h"
|
||||
|
||||
#include "pocketpy/common/name.h"
|
||||
|
||||
extern "C" void pk__add_module_libhv();
|
||||
|
||||
void libhv_HttpRequest_create(py_OutRef out, HttpRequestPtr ptr);
|
||||
|
@ -3,9 +3,6 @@
|
||||
#include "pocketpy/pocketpy.h"
|
||||
#include "http/client/WebSocketClient.h"
|
||||
|
||||
extern py_Name __new__;
|
||||
extern py_Name __init__;
|
||||
|
||||
struct libhv_WebSocketClient {
|
||||
hv::WebSocketClient ws;
|
||||
|
||||
|
@ -14,7 +14,7 @@ typedef struct NameBucket {
|
||||
|
||||
static struct {
|
||||
NameBucket* table[0x10000];
|
||||
atomic_bool lock;
|
||||
atomic_flag lock;
|
||||
} pk_string_table;
|
||||
|
||||
#define MAGIC_METHOD(x) py_Name x;
|
||||
@ -40,7 +40,7 @@ void pk_names_finalize() {
|
||||
}
|
||||
|
||||
py_Name py_namev(c11_sv name) {
|
||||
while(atomic_exchange(&pk_string_table.lock, true)) {
|
||||
while(atomic_flag_test_and_set(&pk_string_table.lock)) {
|
||||
// busy-wait until the lock is released
|
||||
}
|
||||
uint64_t hash = c11_sv__hash(name);
|
||||
@ -58,7 +58,7 @@ py_Name py_namev(c11_sv name) {
|
||||
p = p->next;
|
||||
}
|
||||
if(found) {
|
||||
atomic_store(&pk_string_table.lock, false);
|
||||
atomic_flag_clear(&pk_string_table.lock);
|
||||
return (py_Name)p;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ py_Name py_namev(c11_sv name) {
|
||||
assert(prev->next == NULL);
|
||||
prev->next = bucket;
|
||||
}
|
||||
atomic_store(&pk_string_table.lock, false);
|
||||
atomic_flag_clear(&pk_string_table.lock);
|
||||
return (py_Name)bucket;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user