Channel support for threads. Note: This is part of the system module. Do not import it directly. To activate thread support you need to compile with the --threads:on command line switch.
Note: The current implementation of message passing does not work with cyclic data structures. Note: Channels cannot be passed between threads. Use globals or pass them by ptr.
Channel* {...}{.gcsafe.}[TMsg] = RawChannelproc send*[TMsg](c: var Channel[TMsg]; msg: TMsg) {...}{.inline.}proc trySend*[TMsg](c: var Channel[TMsg]; msg: TMsg): bool {...}{.inline.}proc recv*[TMsg](c: var Channel[TMsg]): TMsg
peek to avoid the blocking. proc tryRecv*[TMsg](c: var Channel[TMsg]): tuple[dataAvailable: bool, msg: TMsg]
(false, default(msg)) otherwise it returns (true, msg). proc peek*[TMsg](c: var Channel[TMsg]): int
tryRecv instead. proc open*[TMsg](c: var Channel[TMsg]; maxItems: int = 0)
proc close*[TMsg](c: var Channel[TMsg])
proc ready*[TMsg](c: var Channel[TMsg]): bool
© 2006–2018 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/channels.html