Skip to content

Instantly share code, notes, and snippets.

@StephenCleary
StephenCleary / AutoResetCancellationTokenSource.cs
Created September 14, 2023 12:30
Resettable CTSs using InterlockedState
using System.Threading;
/// <summary>
/// A <see cref="CancellationTokenSource"/> that resets itself to uncanceled after <see cref="Cancel"/> is called.
/// </summary>
public sealed class AutoResetCancellationTokenSource
{
/// <summary>
/// Cancels any tokens previously returned from <see cref="Token"/>, and resets this instance to an uncancelled state.
/// </summary>
@bmaupin
bmaupin / free-backend-hosting.md
Last active June 27, 2024 09:25
Free backend hosting
@StephenCleary
StephenCleary / ObservableProgress.cs
Last active April 16, 2024 11:22
ObservableProgress
using System;
using System.Reactive.Linq;
using System.Threading;
/// <summary>
/// Helper methods for using observable <see cref="IProgress{T}"/> implementations. These are hot observables.
/// </summary>
public static class ObservableProgress
{
/// <summary>