In System.Threading.Channels
, there's a ChannelOptions.SingleReader
property that selects an optimized implementation if there can only be one read issued at a time.
ChannelOptions
is inherited by BoundedChannelOptions
which has the FullMode
property.
Two of the FullMode
values are able to remove items from the Channel's internal storage/queue:
BoundedChannelFullMode.DropNewest
Removes and ignores the newest item in the channel in order to make room for the item being written.
BoundedChannelFullMode.DropOldest
Removes and ignores the oldest item in the channel in order to make room for the item being written.
Does this removal of the newest/oldest item, which occurs during a write, count as a reader for the purposes of the SingleReader
property?
(That wouldn't make these two values mutually exclusive with SingleReader = true
, but it would mean that when used in combination, not only can two reads not overlap each other, but a read also can't overlap a write.)