diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-01-27 22:50:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 22:50:10 +0100 |
commit | c8418651b190d5614e9221cc7d1ef6e1f69ac1e8 (patch) | |
tree | 93040b261f9ba65ddc22e79d66442fdc9a987b25 | |
parent | 32f0910f11acd88b10422d6dc20477747cda687d (diff) | |
download | Nim-c8418651b190d5614e9221cc7d1ef6e1f69ac1e8.tar.gz |
fixes #13219 (#13272)
-rw-r--r-- | lib/system/channels.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/system/channels.nim b/lib/system/channels.nim index d51659394..65398d65c 100644 --- a/lib/system/channels.nim +++ b/lib/system/channels.nim @@ -367,7 +367,8 @@ proc sendImpl(q: PRawChannel, typ: PNimType, msg: pointer, noBlock: bool): bool proc send*[TMsg](c: var Channel[TMsg], msg: sink TMsg) {.inline.} = ## Sends a message to a thread. `msg` is deeply copied. discard sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), false) - wasMoved(msg) + when defined(gcDestructors): + wasMoved(msg) proc trySend*[TMsg](c: var Channel[TMsg], msg: sink TMsg): bool {.inline.} = ## Tries to send a message to a thread. @@ -377,8 +378,9 @@ proc trySend*[TMsg](c: var Channel[TMsg], msg: sink TMsg): bool {.inline.} = ## Returns `false` if the message was not sent because number of pending items ## in the channel exceeded `maxItems`. result = sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), true) - if result: - wasMoved(msg) + when defined(gcDestructors): + if result: + wasMoved(msg) proc llRecv(q: PRawChannel, res: pointer, typ: PNimType) = q.ready = true |