清理线程
This commit is contained in:
@@ -39,9 +39,13 @@ class SekaiSyncLib:
|
||||
self.lib.ghp.argtypes = [ctypes.c_char_p]
|
||||
self.lib.ghp.restype = None
|
||||
|
||||
# boot(cwd: *const c_char, name: *const c_char, as_path: *const c_char) -> i32
|
||||
# boot(cwd: *const c_char, name: *const c_char, as_path: *const c_char) -> c_int
|
||||
self.lib.boot.argtypes = [ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p]
|
||||
self.lib.boot.restype = ctypes.c_int32
|
||||
self.lib.boot.restype = ctypes.c_int
|
||||
|
||||
# stop() -> c_int
|
||||
self.lib.stop.argtypes = []
|
||||
self.lib.stop.restype = ctypes.c_int
|
||||
|
||||
# fetch_data() -> *mut c_char
|
||||
# ⚠️ 这里必须用 c_void_p,不能用 c_char_p,否则会丢失指针地址导致内存泄漏
|
||||
@@ -77,6 +81,12 @@ class SekaiSyncLib:
|
||||
self._str_to_bytes(as_path)
|
||||
)
|
||||
|
||||
def stop(self) -> int:
|
||||
"""
|
||||
停止主循环与清理状态
|
||||
"""
|
||||
return self.lib.stop()
|
||||
|
||||
def fetch_data(self) -> Optional[FetchData]:
|
||||
# 1. 获取裸指针
|
||||
ptr = self.lib.fetch_data()
|
||||
|
||||
Reference in New Issue
Block a user