Skip to content

A replacement for System.Threading.CancellationToken, but with support for removable registrations, some garbage collection optimizations, and some additional related utilities.

License

Notifications You must be signed in to change notification settings

Arcturus-Studio/Lifetime

Repository files navigation

Lifetime

A 'Lifetime' is a slightly more flexible System.Threading.CancellationToken.

  • 'WhenDead' callback registrations can be removed (by giving them lifetimes that end)
  • When a LifetimeSource is garbage collected, its associated lifetime transitions to being immortal (allowing garbage collection of unrun WhenDead callbacks)
  • Can be implicitly converted to a CancellationToken

There are also some utility methods (Max/Min/CreateDependentSource) and classes (LifetimeExchanger/DisposableLifetime) provided by the library.

Diagram

The library's whole API is simple enough to fit comfortably in a simple diagram:

API

About

A replacement for System.Threading.CancellationToken, but with support for removable registrations, some garbage collection optimizations, and some additional related utilities.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages