diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-09-24 02:27:04 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-09-24 02:27:12 +0200 |
commit | 2569a58f0859c5a6335ddea88f3752bcc2238d45 (patch) | |
tree | cc55399516e46c8778390042abbca64b3e6ec2bd | |
parent | 66bbf7518e652bfe963f0891a55f45c4711d8be3 (diff) | |
download | Nim-2569a58f0859c5a6335ddea88f3752bcc2238d45.tar.gz |
fixes #4746
-rw-r--r-- | lib/system/channels.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/system/channels.nim b/lib/system/channels.nim index 4d8bc581d..0c97bc8db 100644 --- a/lib/system/channels.nim +++ b/lib/system/channels.nim @@ -242,8 +242,10 @@ proc recv*[TMsg](c: var Channel[TMsg]): TMsg = proc tryRecv*[TMsg](c: var Channel[TMsg]): tuple[dataAvailable: bool, msg: TMsg] = - ## try to receives a message from the channel `c` if available. Otherwise - ## it returns ``(false, default(msg))``. + ## try to receives a message from the channel `c`, but this can fail + ## for all sort of reasons, including contention. If it fails, + ## it returns ``(false, default(msg))`` otherwise it + ## returns ``(true, msg)``. var q = cast[PRawChannel](addr(c)) if q.mask != ChannelDeadMask: if tryAcquireSys(q.lock): |