Closed
Description
EDITED by @stephentoub on 2/17/2024:
namespace System.Threading.Channels;
public class Channel
{
+ public static Channel<T> CreateUnboundedPrioritized<T>();
+ public static Channel<T> CreateUnboundedPrioritized<T>(UnboundedPrioritizedChannelOptions<T> options);
}
+public sealed partial class UnboundedPrioritizedChannelOptions<T> : ChannelOptions
+{
+ public System.Collections.Generic.IComparer<T>? Comparer { get; set; }
+}
Just wondering if anyone knows if a priority channel is available or a potential idea of adding to System.Threading.Channels. Something similar to Bounded/Unbounded channels with Reader/Writer along with priority capabilities. Meaning, you could write a large set of items to a channel in any order, but the reader would be sorted/read by a prioritized item.
I guess when it boils down to it I could use the PriorityQueue
, but I do like the features provided by Channels
.
Referencing
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.priorityqueue-2?view=net-6.0
https://devblogs.microsoft.com/dotnet/an-introduction-to-system-threading-channels/
cc: @stephentoub