Esempio n. 1
0
        /// <summary>
        ///  Enqueues action on to context after timer elapses.
        /// </summary>
        public IDisposable Schedule(Action action, long firstInMs)
        {
            if (firstInMs <= 0L)
            {
                PendingAction pending = new PendingAction(action);
                this._executionContext.Enqueue(new Action(pending.Execute));
                return(pending);
            }
            TimerAction pending2 = new TimerAction(this, action, firstInMs, -1L);

            this.AddPending(pending2);
            return(pending2);
        }