Skip to content

Commit

Permalink
add RwLock inplace initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
darkestpigeon committed Oct 17, 2024
1 parent c69e13a commit c3dfff5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions threading/rwlock.nim
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ else:
proc `=sink`*(dest: var RwLock; source: RwLock) {.error.}
proc `=copy`*(dest: var RwLock; source: RwLock) {.error.}

proc init*(rw: var RwLock) =
zeroMem(addr rw, sizeof(RwLock))
initCond(rw.c)
initLock(rw.L)

proc createRwLock*(): RwLock =
result = default(RwLock)
initCond(result.c)
Expand Down

0 comments on commit c3dfff5

Please sign in to comment.