예제 #1
0
        public T GetResultStacked <T>()
        {
            if (ProcessPipeCommReal.Data.ContainsKey(GUID) == false)
            {
                return(default(T));
            }
            DataHolder h = ProcessPipeCommReal.Data[GUID];
            int        Counter;

            lock (h.ResultLock)
            {
                Counter = h.ResultStacked.Count;
            }

            if (Counter == 0)
            {
                h.ResultMR.WaitOne(30000);
            }

            string r = "";

            lock (h.ResultLock)
            {
                if (h.ResultStacked.Count == 0)
                {
                    h.ResultMR.Reset();
                    return(default(T));
                }
                r = h.ResultStacked[0];
                h.ResultStacked.RemoveAt(0);
                if (h.ResultStacked.Count == 0)
                {
                    h.ResultMR.Reset();
                }
            }

            if (r == "")
            {
                return(default(T));
            }
            return(JsonConvert.DeserializeObject <T>(r));
        }
예제 #2
0
        public string GetTODOStacked()
        {
            if (Data.ContainsKey(GUID) == false)
            {
                return(null);
            }
            DataHolder h = Data[GUID];
            int        Counter;

            lock (h.TODOLock)
            {
                Counter = h.TODOStacked.Count;
            }

            if (Counter == 0)
            {
                h.TODOMR.WaitOne(30000);
            }

            string r = "";

            lock (h.TODOLock)
            {
                if (h.TODOStacked.Count == 0)
                {
                    h.TODOMR.Reset();
                    return(null);
                }
                r = h.TODOStacked[0];
                h.TODOStacked.RemoveAt(0);
                if (h.TODOStacked.Count == 0)
                {
                    h.TODOMR.Reset();
                }
            }

            if (r == "")
            {
                return(null);
            }
            return(r);
        }