https://github.com/crozone/asyncresetevents
Async compatible auto and manual reset events.
https://github.com/crozone/asyncresetevents
Last synced: over 1 year ago
JSON representation
Async compatible auto and manual reset events.
- Host: GitHub
- URL: https://github.com/crozone/asyncresetevents
- Owner: crozone
- License: mit
- Created: 2017-12-13T00:12:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T03:48:22.000Z (over 6 years ago)
- Last Synced: 2025-03-02T16:15:44.164Z (over 1 year ago)
- Language: C#
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AsyncResetEvents
[](https://www.nuget.org/packages/crozone.AsyncResetEvents/)
[]()
Async compatible auto and manual reset events.
## Async compatible reset events
These reset events aim to serve the same purpose as the .NET `AutoResetEvent` and `ManualResetEvent`, but with async methods.
This allows events to be awaited in a manner that doesn't block the thread, allowing easy, efficient, and threadsafe signalling and synchronization.
## Requirements
The library is written for NetStandard 2.0 and .NET 4.5, and is entirely self-contained with no external dependencies.
## Behaviour
TODO: accurately describe the implementation's behaviour in detail.
## Derivative code
The code is based on Stephen Toub's [async primatives implementation](https://blogs.msdn.microsoft.com/pfxteam/2012/02/11/building-async-coordination-primitives-part-2-asyncautoresetevent/)
It is also based on Stephen Cleary's [AsyncEx library](https://github.com/StephenCleary/AsyncEx).
## Implementation
`AsyncAutoResetEvent` and `AsyncManualResetEvent` both share a common underlying implementation, contained within `AsyncResetEvent`. The `AsyncAutoResetEvent` and `AsyncManualResetEvent` classes themselves are really just thin convenience wrappers, and all they do is set a single boolean value within `AsyncResetEvent` to tweak its behaviour between manual and auto modes.
The motivation for this was to provide a straightforward, maintainable, and easy to test implementation. This leads to a slightly less efficient manual reset event, but (IMHO) easier to understand and maintain code.