System.Threading.Channels 高性能异步队列

引言

System.Threading.Channels 是.NET Core 3.0 后推出的新的集合类型, 具有异步API,高性能,线程安全等特点,它提供一个异步数据集合,可用于生产者和消费者之前的数据异步传递。

它提供如下方法:

BoundedChannelOptions

Provides options that control the behavior of bounded Channel<T> instances.

提供通道的行为控制 有限通道

Channel

Provides static methods for creating channels.

提供创建通道的静态方法

Channel<T>

Provides a base class for channels that support reading and writing elements of type T.

泛型通道,写入和读取方类型都为 T

Channel<TWrite,TRead>

Provides a base class for channels that support reading elements of type TRead and writing elements of type TWrite.

泛型通道,分别指定写入和读取方的类型

ChannelClosedException

Exception thrown when a channel is used after it's been closed.

通道在关闭后被调用时会抛出此异常

ChannelOptions

Provides options that control the behavior of channel instances.

提供通道的行为控制

ChannelReader<T>

Provides a base class for reading from a channel.

通道读取方的基类

ChannelWriter<T>

Provides a base class for writing to a channel.

通道写入方的基类

UnboundedChannelOptions

Provides options that control the behavior of unbounded Channel

提供通道的行为控制 无限制通道

BoundedChannelFullMode

Specifies the behavior to use when writing to a bounded channel that is already full.

当通道容量达到最大时 控制通道的写入规则 有限通道

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

James.TCG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值