namespace Channel
A Rimbu Channel offers various ways to synchronize communication between asynchronous processes. These processes can send and receive messages in a blocking way. Channel messages are of type T, and channels can be buffered or unbuffered. A buffered channel can queue a given amount of messages before blocking the sender.
Companion interface: Channel<T>
Interfaces
| Name | Description |
|---|---|
Channel.Config | The configuration options for creating a Channel. |
Channel.Constructors | Defines the static Channel API. |
Channel.Read<T> | A read-only Channel that can perform blocking reads. This means that a receive call will block until a message is available. |
Channel.Write<T> | A write-only Channel that can perform blocking writes. This means that a send call will block until the channel has capacity to send a message. |
Static Methods
create
Returns a new Channel instance that can be used to synchronize asynchronous processes within a single thread.
createDefinition
create<T = void>(options?: Channel.Config): Channel<T>;
Type parameters
| Name | Default | Description |
|---|---|---|
| T | void | the channel message type |
Parameters
| Name | Type | Description |
|---|---|---|
options | Channel.Config | (optional) the options used to create the channel - capacity: (optional) the buffer size of the channel - validator: (optional) a function taking a message and returning true if the message is of a valid type, false otherwise |