예제 #1
0
        /// <summary>
        /// Registers a new fake timer entry and returns it.
        /// Note how we are capturing the activation task scheduler to ensure we can tick the fake timers within the activation context.
        /// </summary>
        public IDisposable RegisterTimer(Grain grain, Func <object, Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period)
        {
            var timer = new FakeTimerEntry(this, TaskScheduler.Current, grain, asyncCallback, state, dueTime, period);

            timers[timer] = timer;
            return(timer);
        }
예제 #2
0
 /// <summary>
 /// Removes a timer.
 /// </summary>
 public void Remove(FakeTimerEntry entry) => timers.TryRemove(entry, out _);