mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-06-21 00:40:16 +00:00
destroyFFIContext stopped/joined the worker threads and marked the slot for rebuild, but no longer deinited the context — so the six ThreadSignalPtr fds were orphaned every full teardown (the exact leak this path exists to prevent), and the still-initialised Lock + event registry/queue locks were left live. createFFIContext's rebuild path (initialized == false) reruns initContextResources, which calls initLock / initEventRegistry / initEventQueue and installs fresh signals over the stale handles — re-initialising a live lock is UB. Restore the deinitContextResources() call (as the pre-recycle code did) before marking the slot uninitialised so the rebuild starts from clean state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nim-ffi
Allows exposing Nim projects to other languages
Example
examples/timer is now a self-contained Nimble project that imports nim-ffi directly.
Use cd examples/timer && nimble install -y ../.. && nimble build to compile the example.
Description
Languages
Nim
87.9%
Smarty
5.9%
C++
4.8%
CMake
1.4%