Esempio n. 1
0
        private void EnqueueCommand(InternalCommand command)
        {
            if (!running)
            {
                return;
            }

            commandQueue.Enqueue(command);
            syncEvent.Set();
        }
Esempio n. 2
0
        private void ProcessCommand(InternalCommand command)
        {
            // logger.Debug("ProcessInternalCommand(...)");

            if (!running)
            {
                return;
            }

            if (command == null)
            {
                return;
            }
        }
Esempio n. 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);
        }
Esempio n. 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);
            }
        }
Esempio n. 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);
         }
     }
 }