We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f313015 commit 74776f1Copy full SHA for 74776f1
threading/channels.nim
@@ -402,6 +402,11 @@ when false:
402
proc peek*[T](c: Chan[T]): int {.inline.} = peek(c.d)
403
404
proc newChan*[T](elements = 30, overwrite = false): Chan[T] =
405
+ ## create a new channel implemented using a ring buffer
406
+ ## with proper multi-threaded locking.
407
+ ##
408
+ ## `overwrite` sets up the channel to overwrite the oldest
409
+ ## data without blocking in `send` or `trySend`.
410
assert elements >= 1, "Elements must be positive!"
411
result = Chan[T](d: allocChannel(sizeof(T), elements))
412
result.d.overwrite = overwrite
0 commit comments