// Basic usage public static async Task DoWorkAsync(PauseToken pause, CancellationToken token) { try { while (true) { token.ThrowIfCancellationRequested(); Console.WriteLine("Before await pause.HandlePauseRequestAsync()"); await pause.HandlePauseRequestAsync(); Console.WriteLine("After await pause.HandlePauseRequestAsync()"); await Task.Delay(1000); } } catch (Exception e) { Console.WriteLine("Exception: {0}", e); throw; } }