Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions layout/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub type Handle = *mut c_void;
#[allow(dead_code)]
extern "C" {
fn kvspaceConnect(dsn: *const c_char) -> Handle;
fn kvspaceFree(h: Handle);
fn kvspaceClose(h: Handle);
fn kvspaceBytesFree(p: *mut u8, len: u32);

fn kvspaceSet(
Expand Down Expand Up @@ -244,7 +244,7 @@ impl Kv {

impl Drop for Kv {
fn drop(&mut self) {
unsafe { kvspaceFree(self.h) };
unsafe { kvspaceClose(self.h) };
}
}

Expand Down
6 changes: 3 additions & 3 deletions runtime-rwirext_example/go/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package json

// kvspace ABI(扩展宿主自连,不经 runtime)——runtime .so 传递解析其后端实现。
extern void *kvspaceConnect(const char *dsn);
extern void kvspaceFree(void *h);
extern void kvspaceClose(void *h);
extern void kvspaceBytesFree(uint8_t *p, uint32_t len);
extern int kvspaceGet(void *h, const char *key, uint8_t **out, uint32_t *out_len);
extern int kvspaceSet(void *h, const char *const *keys, const uint8_t *vals,
Expand Down Expand Up @@ -620,7 +620,7 @@ func connect(dsn string) unsafe.Pointer {
}

func disconnect(c unsafe.Pointer) {
C.kvspaceFree(c)
C.kvspaceClose(c)
}

// Serve 常驻循环:注册 + 监控 .todo + 批量执行 + 交还 PC。
Expand All @@ -629,7 +629,7 @@ func Serve(dsn string) {
if c == nil {
return
}
defer C.kvspaceFree(c)
defer C.kvspaceClose(c)
register(c)
for {
for _, o := range ops {
Expand Down
4 changes: 2 additions & 2 deletions runtime-rwirext_example/rust/term/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ unsafe extern "C" {

// kvspace ABI(扩展宿主自连:读状态、写 pc)
fn kvspaceConnect(dsn: *const c_char) -> *mut c_void;
fn kvspaceFree(h: *mut c_void);
fn kvspaceClose(h: *mut c_void);
fn kvspaceBytesFree(p: *mut u8, len: u32);
fn kvspaceGet(h: *mut c_void, key: *const c_char, out: *mut *mut u8, out_len: *mut u32) -> c_int;
fn kvspaceSet(
Expand Down Expand Up @@ -287,5 +287,5 @@ fn main() {
}
}

unsafe { kvspaceFree(kv) };
unsafe { kvspaceClose(kv) };
}
2 changes: 1 addition & 1 deletion runtime/src/kv.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kvlangKv_t *kvlangKvConnect(const char *dsn) {

void kvlangKvDisconnect(kvlangKv_t *k) {
if (!k) return;
if (k->h) kvspaceFree(k->h);
if (k->h) kvspaceClose(k->h);
free(k);
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/runtime_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ typedef struct {
} kvspaceHead_t;

extern void *kvspaceConnect(const char *dsn);
extern void kvspaceFree(void *h);
extern void kvspaceClose(void *h);
extern void kvspaceBytesFree(uint8_t *p, uint32_t len);
extern int kvspaceSet(void *h, const char *const *keys, const uint8_t *vals,
const uint32_t *lens, uint32_t n, char *err, uint32_t err_cap);
Expand Down
Loading