Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #13219 #13272

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/system/channels.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down