servicetitan / Stl.Fusion

Build real-time apps (Blazor included) with less than 1% of extra code responsible for real-time updates. Host 10-1000x faster APIs relying on transparent and nearly 100% consistent caching. We call it DREAM, or Distributed REActive Memoization, and it's here to turn real-time on!
MIT License
1.82k stars 106 forks source link

Add Stl.Async-way of awaiting WaitHandle #672

Open AliveDevil opened 7 months ago

AliveDevil commented 7 months ago

I'd like to see some general-purpose ready-to-use implementation of Task WaitOneAsync(this WaitHandle, CancellationToken). Maybe going as far as returning a ValueTask, though that may be challenging here.

Proposed API:

Task WaitOneAsync(this WaitHandle, CancellationToken = default)
Task WaitOneAsync(this WaitHandle, int Timeout, CancellationToken = default)
AliveDevil commented 7 months ago

If this is a worthwhile addition, I can check to implement this in the not-so distant future.

alexyakunin commented 7 months ago

Hi, sorry, just noticed this - IMO this can wait. As far as I remember, Stl.* doesn't await on WaitHandle-s, so I'd rather postpone this until it's going to be necessary.

alexyakunin commented 7 months ago

@AliveDevil ^