示例#1
0
        public T Enqueue <T>(T command) where T : CommandBase
        {
            _commands.Enqueue(command);

            Enqueued?.Invoke(this, new CommandRunnerEvent(command));

            DispatchNext();

            return(command);
        }
示例#2
0
        public bool TryEnqueue(TValue element)
        {
            lock (_sync)
            {
                if (_order.ContainsKey(element))
                {
                    return(false);
                }

                _order.Add(element, _counter++);
                _values.Add(element);
            }

            Enqueued?.Invoke(this, element);
            return(true);
        }
示例#3
0
 public bool TryEnqueue(T item, int timeout = System.Threading.Timeout.Infinite)
 {
     if (Monitor.TryEnter(q, timeout))
     {
         try
         {
             q.Enqueue(item);
             Enqueued?.Invoke(this, EventArgs.Empty);
         }
         finally { Monitor.Exit(q); }
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#4
0
 public void Enqueue(T item)
 {
     queue.Enqueue(item);
     Enqueued?.Invoke(null, item);
 }
示例#5
0
 private void WakeProcessor() => Enqueued?.Invoke(this, EventArgs.Empty);
示例#6
0
 public virtual void Enqueue(T item)
 {
     queue.Enqueue(item);
     Enqueued?.Invoke(this, new ItemEventArgs <T>(item));
     dequeueEvent.Set();
 }
示例#7
0
 public override void OnEnqueue(MachineId machineId, string eventName)
 {
     base.OnEnqueue(machineId, eventName);
     Enqueued?.Invoke(machineId, eventName);
 }
示例#8
0
 public void OnEnqueued(object sender, PersonModel person, RoomModel room)
 {
     Enqueued?.Invoke(sender, new EnqueingEventArgs(person, room));
 }
 public void Enqueue(T directory)
 {
     Queue.Enqueue(directory);
     Enqueued?.Invoke();
 }