pinvoke
pinvoke copied to clipboard
Support Win32 Events
Overlapped I/O uses Win32 events to signal the completion of an overlapped I/O operation. .NET nor PInvoke.Kernel32 provide built-in support for working with Win32 events.
Consider adding support for:
CreateEventEx,SetEventandResetEvent. There are P/Invoke declarations in .NET Core- Asynchronously awaiting events. Microsoft.VisualStudio.Threading.TplExtensions.ToTask provides a reference implementation.
Split off from https://github.com/dotnet/pinvoke/pull/513#discussion_r456068538
The p/invokes are fine to add. I'm less convinced we should create and/or expose an GetAwaiter extension for WaitHandle, particularly since it's already done in a public Microsoft-owned package.
If we needed a copy internally, we could consider that.