StephenCleary / AsyncEx

A helper library for async/await.
MIT License
3.49k stars 358 forks source link

Feature Request: AsyncManualResetEvent pulse #247

Closed danbopes closed 1 year ago

danbopes commented 2 years ago

The AsyncManualResetEvent in visualstudio.threading, supports single pulses of the manualresetevent.

Can we add something similar in nito?

See source code

StephenCleary commented 2 years ago

How would you expect to use this? I'm wondering if there is a more appropriate coordination primitive.

Nito.AsyncEx already has support for condition variables and monitors (and auto-reset events), which support pulsing. My hesitation around adding this to ManualResetEvent is that the Win32 (and BCL) MRE types do not support pulsing. But if it's useful enough for a specific use case that would be too awkward using something like a condition variable, then I'll certainly add it.

danbopes commented 2 years ago

NP, seems AsyncAutoResetEvent may fit my needs. I just saw it in a commonly used DLL by Microsoft, thought it would be a good addition here (For those that actually may have that corner case that could use it). Feel free to close, if you think it'd be an awkward add.