mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-21 00:40:16 +00:00
refactor: drop dead clearContext proc
clearContext had no call sites left after the pool refactor split teardown into stopAndJoinThreads + cleanUpResources / destroyFFIContext. Remove it and repoint the ThreadExitTimeout doc comment, which still named it, at stopAndJoinThreads. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
1c99eaa189
commit
e433624645
@ -361,7 +361,7 @@ proc signalStop*[T](ctx: ptr FFIContext[T]): Result[void, string] =
|
||||
|
||||
## If the FFI thread's event loop is blocked by a synchronous handler
|
||||
## (e.g. blocking I/O), it cannot process reqSignal in time to exit.
|
||||
## clearContext waits on threadExitSignal up to this bound; on timeout it
|
||||
## stopAndJoinThreads waits on threadExitSignal up to this bound; on timeout it
|
||||
## returns err and skips joinThread/cleanup (leaking the thread + ctx slot)
|
||||
## rather than hanging the caller forever.
|
||||
const ThreadExitTimeout* = 1500.milliseconds
|
||||
@ -385,11 +385,3 @@ proc stopAndJoinThreads*[T](ctx: ptr FFIContext[T]): Result[void, string] =
|
||||
joinThread(ctx.ffiThread)
|
||||
joinThread(ctx.watchdogThread)
|
||||
return ok()
|
||||
|
||||
proc clearContext[T](ctx: ptr FFIContext[T]): Result[void, string] =
|
||||
## Stops the FFI context that was created via createFFIContext[T]() (heap).
|
||||
ctx.stopAndJoinThreads().isOkOr:
|
||||
return err("clearContext: " & $error)
|
||||
ctx.cleanUpResources().isOkOr:
|
||||
return err("cleanUpResources failed: " & $error)
|
||||
return ok()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user