changeset 7:f48a2df9da65

fix
author riono <e165729@ie.u-ryukyu.ac.jp>
date Fri, 09 Oct 2020 00:24:06 +0900
parents 5c334a1fbc5e
children e6f5b7d14dd1
files datagear/DataGears.cs
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/datagear/DataGears.cs	Wed Sep 23 13:15:18 2020 +0900
+++ b/datagear/DataGears.cs	Fri Oct 09 00:24:06 2020 +0900
@@ -1,11 +1,13 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.Linq;
+using Christie_net.datagear.command;
 
 namespace Christie_net.datagear.dg {
     public class DataGears {
-        protected SortedDictionary<string, BlockingCollection<DataGear<Type>>> dataGears = 
-            new SortedDictionary<string, BlockingCollection<DataGear<Type>>>();
+        protected SortedDictionary<string, ConcurrentQueue<DataGear<Type>>> dataGears = 
+            new SortedDictionary<string, ConcurrentQueue<DataGear<Type>>>();
         private object syncObject = new object();
 
         public void Put(string key, DataGear<Type> dg) {
@@ -14,6 +16,14 @@
             }
         }
 
+        public object Take(string key) {
+            DataGear<Type> data;
+            if (dataGears[key].TryDequeue(out data)) {
+                data.GetData();
+            }
+            return data;
+        }
+
         public object Peek(string key) {
             return dataGears.
         }