Пример #1
0
        public void PeacemakerRequest()
        {
            if (!this.IsReady)
            {
                return;
            }

            IsBusy = true;
            List <DealRequest> LDRequests = null;

            lock (DataDealRequest)
                LDRequests = DataDealRequest.Values.ToList();
            LDRequests.Reverse();

            bool requested = false;

            foreach (DealRequest DRequest in LDRequests)
            {
                if (DRequest.IsAlive) //execute all alive requests at once
                {
                    ThreadRequest.Run(() => this.DealInstantExecute(DRequest), "Request_Exe_" + DRequest.CreationTime, true, true);
                    requested = true;
                }
            }

            ThreadRequest.JoinAll();

            if (requested)
            {
                DataDeals.IsValid = false;
            }
        }
Пример #2
0
        public void StopAll()
        {
            Method.Terminate("main");


            var keys = D2Sockets.Keys;

            try
            {
                ThreadedMethod methods = new ThreadedMethod(keys.Length);

                foreach (string key in keys)
                {
                    methods.Run(() => this.Stop(key), "stop" + key, true, false);
                }

                methods.JoinAll();
            }
            finally
            {
                Method.Terminate(() => StartListening());
            }
        }