static async Task Test(CancellationToken token) { var pts = new PauseTokenSource(); var task = DoWorkAsync(pts.Token, token); while (true) { token.ThrowIfCancellationRequested(); Console.WriteLine("Press enter to pause..."); Console.ReadLine(); Console.WriteLine("Before pause requested"); await pts.PauseAsync(); Console.WriteLine("After pause requested, paused: " + await pts.IsPaused()); Console.WriteLine("Press enter to resume..."); Console.ReadLine(); Console.WriteLine("Before resume"); await pts.ResumeAsync(); Console.WriteLine("After resume"); } }