Skip to content

Commit c841865

Browse files
authored
fixes #13219 (#13272)
1 parent 32f0910 commit c841865

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/system/channels.nim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ proc sendImpl(q: PRawChannel, typ: PNimType, msg: pointer, noBlock: bool): bool
367367
proc send*[TMsg](c: var Channel[TMsg], msg: sink TMsg) {.inline.} =
368368
## Sends a message to a thread. `msg` is deeply copied.
369369
discard sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), false)
370-
wasMoved(msg)
370+
when defined(gcDestructors):
371+
wasMoved(msg)
371372
372373
proc trySend*[TMsg](c: var Channel[TMsg], msg: sink TMsg): bool {.inline.} =
373374
## Tries to send a message to a thread.
@@ -377,8 +378,9 @@ proc trySend*[TMsg](c: var Channel[TMsg], msg: sink TMsg): bool {.inline.} =
377378
## Returns `false` if the message was not sent because number of pending items
378379
## in the channel exceeded `maxItems`.
379380
result = sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), true)
380-
if result:
381-
wasMoved(msg)
381+
when defined(gcDestructors):
382+
if result:
383+
wasMoved(msg)
382384
383385
proc llRecv(q: PRawChannel, res: pointer, typ: PNimType) =
384386
q.ready = true

0 commit comments

Comments
 (0)