Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrBufferIsEmpty = errors.New("buffer is empty")
)
Functions ¶
This section is empty.
Types ¶
type Unbounded ¶
type Unbounded[V any] struct { // contains filtered or unexported fields }
Unbounded 是无界缓冲区的实现
func NewUnbounded ¶
NewUnbounded 创建一个无界缓冲区
- generateNil: 生成空值的函数,该函数仅需始终返回 nil 即可
该缓冲区来源于 gRPC 的实现,用于在不使用额外 goroutine 的情况下实现无界缓冲区
- 该缓冲区的所有方法都是线程安全的,除了用于同步的互斥锁外,不会阻塞任何东西
func NewUnboundedN ¶ added in v0.2.1
NewUnboundedN 与 NewUnbounded 相同,只是省略了 generateNil 参数
Click to show internal directories.
Click to hide internal directories.