Skip to content

Commit d94c018

Browse files
authored
Merge pull request #29 from nim-lang/araq-recv-fix
added proper 'recv' API
2 parents 8f6a368 + 41c184b commit d94c018

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

threading/channels.nim

+4
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ proc recv*[T](c: Chan[T], dst: var T) {.inline.} =
386386
## Receives item from the channel (blocking).
387387
discard channelReceive(c, dst.addr, sizeof(dst), true)
388388

389+
proc recv*[T](c: Chan[T]): T {.inline.} =
390+
## Receives item from the channel (blocking).
391+
discard channelReceive(c, result.addr, sizeof(result), true)
392+
389393
proc recvIso*[T](c: Chan[T]): Isolated[T] {.inline.} =
390394
var dst: T
391395
discard channelReceive(c, dst.addr, sizeof(dst), true)

0 commit comments

Comments
 (0)