Skip to content

Commit

Permalink
adding comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Feb 12, 2025
1 parent f64e4a3 commit 5a5c94f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/waku_thread/waku_thread.nim
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ proc sendRequestToWakuThread*(
userData: pointer,
): Result[void, string] =
let req = WakuThreadRequest.createShared(reqType, reqContent, callback, userData)
## Sending the request

# This lock is only necessary while we use a SP Channel and while the signalling
# between threads assumes that there aren't concurrent requests.
# Rearchitecting the signaling + migrating to a MP Channel will allow us receive
# requests concurrently and spare us the need of locks
ctx.lock.acquire()
## Sending the request
let sentOk = ctx.reqChannel.trySend(req)
if not sentOk:
ctx.lock.release()
Expand Down

0 comments on commit 5a5c94f

Please sign in to comment.