user1892538 user1892538 - 1 month ago 10
Linux Question

P/invoke and overlapped I/O in Core CLR on Unix?

I know that .Net Core can run on Mac and Unix.

What happens to Win32 classes like the overlapped I/O and how do an I/O request packet translate into Unix?

If I correctly understand, those win32 classes and structures are the basis of

async
/
await
with P/Invoke I/O instructions.

Answer Source

There is a platform abstraction layer implemented by the CoreCLR that handles the implementation using the appropriate OS capabilities for asynchronous I/O. For example, on platforms that support kevent (such as FreeBSD and macOS), they will use kqueue for queuing and raising I/O callbacks. This is one of the many areas, but a good place to start understanding the CoreCLR and tie it back to the managed implementations.

https://github.com/dotnet/coreclr/blob/dd1e7ab81221127e47d59052c51c09921007d607/src/pal/src/synchmgr/synchmanager.cpp#L2103