Beispiel #1
0
        private void EnqueueCommand(InternalCommand command)
        {
            if (!running)
            {
                return;
            }

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

            if (!running)
            {
                return;
            }

            if (command == null)
            {
                return;
            }
        }
Beispiel #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);
        }
Beispiel #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);
            }
        }
Beispiel #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);
         }
     }
 }