Discover Packages
capnproto.org/go/capnp/v3
exp
mpsc
package
Version:
v3.0.0-alpha.15
Opens a new window with list of versions in this module.
Published: Dec 16, 2022
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package mpsc implements a multiple-producer, single-consumer queue.
type Queue[T any ] struct {
Tx [T]
Rx [T]
}
A multiple-producer, single-consumer queue. Create one with New(),
and send from many gorotuines with Tx.Send(). Only one gorotuine may
call Rx.Recv().
Create a new, initially empty Queue.
type Rx[T any ] struct {
}
The receive end of a Queue.
Receive a message from the queue. Blocks if the queue is empty.
If the context ends before the receive happens, this returns
ctx.Err().
func (rx *Rx [T]) TryRecv() (v T, ok bool )
Try to receive a message from the queue. If successful, ok will be true.
If the queue is empty, this will return immediately with ok = false.
type Tx[T any ] struct {
}
The send/transmit end of a Queue.
func (tx *Tx [T]) Send(v T)
Send a message on the queue.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.