Exemple #1
0
        public static void GracefulShutdown()
        {
            using var counter = new Counter();
            var timer = new AsyncTimer(counter.Run);
            var task  = timer.DisposeAsync();

            True(task.IsCompletedSuccessfully);
        }
Exemple #2
0
        public static async Task GracefulShutdownAsync()
        {
            using var counter = new Counter();
            var timer = new AsyncTimer(counter.Run);

            True(timer.Start(TimeSpan.FromMilliseconds(10)));
            True(counter.WaitOne(DefaultTimeout));
            True(timer.IsRunning);
            await timer.DisposeAsync();

            False(timer.IsRunning);
        }