From 2ce6afb909f34af7d78c20cfeb9f2d8311e91336 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Fri, 3 Oct 2025 01:55:11 +0300 Subject: Changed RealTimeGraphX to .NET 4.6.1 --- .../RealTimeGraphX/GraphDataQueue.cs | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Software/Visual_Studio/SideChains/RealTimeGraphXNet/RealTimeGraphX/GraphDataQueue.cs (limited to 'Software/Visual_Studio/SideChains/RealTimeGraphXNet/RealTimeGraphX/GraphDataQueue.cs') diff --git a/Software/Visual_Studio/SideChains/RealTimeGraphXNet/RealTimeGraphX/GraphDataQueue.cs b/Software/Visual_Studio/SideChains/RealTimeGraphXNet/RealTimeGraphX/GraphDataQueue.cs new file mode 100644 index 000000000..cb28231ab --- /dev/null +++ b/Software/Visual_Studio/SideChains/RealTimeGraphXNet/RealTimeGraphX/GraphDataQueue.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace RealTimeGraphX +{ + /// + /// Represents a blocking concurrent queue for graph data consumption. + /// + /// + /// + public class GraphDataQueue : BlockingCollection + { + /// + /// Initializes a new instance of the GraphDataQueue, Use Add and TryAdd for Enqueue and TryEnqueue and Take and TryTake for Dequeue and TryDequeue functionality + /// + public GraphDataQueue() + : base(new ConcurrentQueue()) + { + } + + /// + /// Initializes a new instance of the GraphDataQueue, Use Add and TryAdd for Enqueue and TryEnqueue and Take and TryTake for Dequeue and TryDequeue functionality + /// + /// + public GraphDataQueue(int maxSize) + : base(new ConcurrentQueue(), maxSize) + { + } + + /// + /// Enqueues the specified item. + /// + /// The item. + public void BlockEnqueue(T item) + { + Add(item); + } + + /// + /// Blocks until an item is available for dequeuing. + /// + /// + public T BlockDequeue() + { + return Take(); + } + + /// + /// Blocks until an item is available for dequeuing. + /// + /// The cancellation token. + /// + public T BlockDequeue(CancellationToken cancellationToken) + { + return Take(cancellationToken); + } + } +} -- cgit v1.3.1