parent
32f0910f11
commit
c8418651b1
1 changed files with 5 additions and 3 deletions
|
|
@ -367,6 +367,7 @@ proc sendImpl(q: PRawChannel, typ: PNimType, msg: pointer, noBlock: bool): bool
|
||||||
proc send*[TMsg](c: var Channel[TMsg], msg: sink TMsg) {.inline.} =
|
proc send*[TMsg](c: var Channel[TMsg], msg: sink TMsg) {.inline.} =
|
||||||
## Sends a message to a thread. `msg` is deeply copied.
|
## Sends a message to a thread. `msg` is deeply copied.
|
||||||
discard sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), false)
|
discard sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), false)
|
||||||
|
when defined(gcDestructors):
|
||||||
wasMoved(msg)
|
wasMoved(msg)
|
||||||
|
|
||||||
proc trySend*[TMsg](c: var Channel[TMsg], msg: sink TMsg): bool {.inline.} =
|
proc trySend*[TMsg](c: var Channel[TMsg], msg: sink TMsg): bool {.inline.} =
|
||||||
|
|
@ -377,6 +378,7 @@ 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
|
## Returns `false` if the message was not sent because number of pending items
|
||||||
## in the channel exceeded `maxItems`.
|
## in the channel exceeded `maxItems`.
|
||||||
result = sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), true)
|
result = sendImpl(cast[PRawChannel](addr c), cast[PNimType](getTypeInfo(msg)), unsafeAddr(msg), true)
|
||||||
|
when defined(gcDestructors):
|
||||||
if result:
|
if result:
|
||||||
wasMoved(msg)
|
wasMoved(msg)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue