mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-04-02 18:13:18 +00:00
try not using Lock in libsds.nim
This commit is contained in:
parent
38d7d2807b
commit
d291ffa5fa
@ -60,13 +60,10 @@ template callEventCallback(ctx: ptr SdsContext, eventName: string, body: untyped
|
||||
const MaxNumContexts = 32
|
||||
var
|
||||
ctxPool: array[MaxNumContexts, ptr SdsContext]
|
||||
ctxPoolLock: Lock
|
||||
|
||||
proc acquireCtx(callback: SdsCallBack, userData: pointer): ptr SdsContext =
|
||||
echo "acquireCtx called 1"
|
||||
ctxPoolLock.acquire()
|
||||
echo "acquireCtx called 2"
|
||||
defer: ctxPoolLock.release()
|
||||
echo "acquireCtx called 3"
|
||||
|
||||
for i in 0 ..< ctxPool.len:
|
||||
@ -90,9 +87,7 @@ proc acquireCtx(callback: SdsCallBack, userData: pointer): ptr SdsContext =
|
||||
|
||||
proc releaseCtx(ctx: ptr SdsContext) =
|
||||
echo "releaseCtx called"
|
||||
ctxPoolLock.acquire()
|
||||
echo "releaseCtx called 2"
|
||||
defer: ctxPoolLock.release()
|
||||
echo "releaseCtx called 3"
|
||||
for i in 0 ..< ctxPool.len:
|
||||
echo "releaseCtx called 4, i=" & $i
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user