Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel[T any] struct { // contains filtered or unexported fields }
Channel[T] is a multi-producer, single-consumer channel of items with monotonicaly-increasing sequence numbers. Items can be sent in any order, but they are always received in order of their sequence number. It is unsafe to call Next concurrently with itself, or to call Add/Reserve concurrently with another Add/Reserve call for the same sequence number. Otherwise, methods are safe to call concurrently.
func (*Channel[T]) Add ¶
Send an item with the given sequence number. Blocks if the channel does not have capacity for the item. It is undefined behavior to send a sequence number that has previously been sent.
Click to show internal directories.
Click to hide internal directories.