diff options
Diffstat (limited to 'lib/system/channels.nim')
-rw-r--r-- | lib/system/channels.nim | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/system/channels.nim b/lib/system/channels.nim index 4796ebb82..3e5ca0795 100644 --- a/lib/system/channels.nim +++ b/lib/system/channels.nim @@ -49,9 +49,9 @@ proc deinitRawChannel(p: pointer) = deinitSysCond(c.cond) proc storeAux(dest, src: pointer, mt: PNimType, t: PRawChannel, - mode: TLoadStoreMode) {.gcsafe.} + mode: TLoadStoreMode) {.benign.} proc storeAux(dest, src: pointer, n: ptr TNimNode, t: PRawChannel, - mode: TLoadStoreMode) {.gcsafe.} = + mode: TLoadStoreMode) {.benign.} = var d = cast[ByteAddress](dest) s = cast[ByteAddress](src) @@ -225,15 +225,15 @@ proc recv*[TMsg](c: var TChannel[TMsg]): TMsg = acquireSys(q.lock) llRecv(q, addr(result), cast[PNimType](getTypeInfo(result))) releaseSys(q.lock) - -proc tryRecv*[TMsg](c: var TChannel[TMsg]): tuple[dataAvailable: bool, - msg: TMsg] = - ## try to receives a message from the channel `c` if available. Otherwise - ## it returns ``(false, default(msg))``. + +proc tryRecv*[TMsg](c: var TChannel[TMsg]): tuple[dataAvailable: bool, + msg: TMsg] = + ## try to receives a message from the channel `c` if available. Otherwise + ## it returns ``(false, default(msg))``. var q = cast[PRawChannel](addr(c)) - if q.mask != ChannelDeadMask: + if q.mask != ChannelDeadMask: if tryAcquireSys(q.lock): - llRecv(q, addr(result.msg), cast[PNimType](getTypeInfo(result.msg))) + llRecv(q, addr(result.msg), cast[PNimType](getTypeInfo(result.msg))) result.dataAvailable = true releaseSys(q.lock) |