mirror of
https://github.com/logos-messaging/nim-ffi.git
synced 2026-05-06 18:29:27 +00:00
make sure the lock is init before cleanUpResources
This commit is contained in:
parent
73221eb1d4
commit
f9f2025b98
@ -197,13 +197,16 @@ proc createFFIContext*[T](): Result[ptr FFIContext[T], string] =
|
||||
## This proc is called from the main thread and it creates
|
||||
## the FFI working thread.
|
||||
var ctx = createShared(FFIContext[T], 1)
|
||||
ctx.lock.initLock()
|
||||
|
||||
ctx.reqSignal = ThreadSignalPtr.new().valueOr:
|
||||
ctx.cleanUpResources()
|
||||
return err("couldn't create reqSignal ThreadSignalPtr")
|
||||
|
||||
ctx.reqReceivedSignal = ThreadSignalPtr.new().valueOr:
|
||||
ctx.cleanUpResources()
|
||||
return err("couldn't create reqReceivedSignal ThreadSignalPtr")
|
||||
ctx.lock.initLock()
|
||||
|
||||
ctx.registeredRequests = addr ffi_types.registeredRequests
|
||||
|
||||
ctx.running.store(true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user