private void EnqueueCommand(InternalCommand command) { if (!running) { return; } commandQueue.Enqueue(command); syncEvent.Set(); }
private void ProcessCommand(InternalCommand command) { // logger.Debug("ProcessInternalCommand(...)"); if (!running) { return; } if (command == null) { return; } }
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); }
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); } }
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); } } }