Пример #1
0
        private void EnqueueCommand(InternalCommand command)
        {
            if (!running)
            {
                return;
            }

            commandQueue.Enqueue(command);
            syncEvent.Set();
        }
Пример #2
0
        private void ProcessCommand(InternalCommand command)
        {
            // logger.Debug("ProcessInternalCommand(...)");

            if (!running)
            {
                return;
            }

            if (command == null)
            {
                return;
            }
        }
Пример #3
0
        public void PostMessage(ServerRequest request)
        {
            var id   = request.SenderId;
            var cmd  = request.Command;
            var args = request.Args;

            logger.Debug("IRemoteDesktopClient::PostMessage(...) " + id + " " + cmd);

            var command = new InternalCommand
            {
                command = cmd,
                args    = args,
            };

            EnqueueCommand(command);
        }
Пример #4
0
        public InternalCommand Dequeue()
        {
            lock (locker)
            {
                InternalCommand command = null;
                if (list.Count > 0)
                {
                    command = list.First();
                    list.RemoveFirst();

                    var key = command.command;
                    if (dict.ContainsKey(key))
                    {
                        dict.Remove(key);
                    }
                }
                return(command);
            }
        }
Пример #5
0
 public void Enqueue(InternalCommand command)
 {
     lock (locker)
     {
         //if(list.Count> maxCount)
         //{
         //    //...
         //}
         var key = command.command;
         if (dict.ContainsKey(key))
         {
             var node = dict[key];
             node.Value = command;
         }
         else
         {
             LinkedListNode <InternalCommand> node = list.AddLast(command);
             dict.Add(key, node);
         }
     }
 }