Skip to content

Commit

Permalink
adapt weave to non-var destructors
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Nov 21, 2023
1 parent 7682784 commit f277013
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions weave/cross_thread_com/event_notifiers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,18 @@ func initialize*(en: var EventNotifier) {.inline.} =
en.phase.store(0, moRelaxed)
en.signaled.store(false, moRelaxed)

func `=destroy`*(en: var EventNotifier) {.inline.} =
when not supportsFutex:
en.cond.deinitCond()
en.lock.deinitLock()
when defined(nimAllowNonVarDestructor):
func `=destroy`*(en: EventNotifier) {.inline.} =
when not supportsFutex:
en.cond.deinitCond()
en.lock.deinitLock()
else:
func `=destroy`*(en: var EventNotifier) {.inline.} =
when not supportsFutex:
en.cond.deinitCond()
en.lock.deinitLock()

func `=`*(dst: var EventNotifier, src: EventNotifier) {.error: "An event notifier cannot be copied".}
func `=copy`*(dst: var EventNotifier, src: EventNotifier) {.error: "An event notifier cannot be copied".}
func `=sink`*(dst: var EventNotifier, src: EventNotifier) {.error: "An event notifier cannot be moved".}

func prepareToPark*(en: var EventNotifier) {.inline.} =
Expand Down

0 comments on commit f277013

Please sign in to comment.