More on updating the rktio library

I have started some work on this in earnest. A reorganization of the rktio.h header file was merged which removed some road blocks with my workflow with VS Code. This does not mean VS Code is required.

In terms of OS compatibility. In terms of the Win32 API, I think targeting Windows XP SP3 or Windows Server 2003 should work. Any code that is specific to older versions can be removed with a comment on what was removed. I feel this is a reasonable level of backwards compatibility in terms of Windows. Also it is assumed that the ucrt library will be used for all the builds as has been discussed before.

This does not mean there aren't newer APIs being used. Functions like IsWindows10OrGreater() defined in VersionHelpers.h make is so that newer APIs are used when the OS supports it, falling back to older code otherwise.

An example of this is in rktio_console.c. The console mode is set with a completely different set of flags on Windows 10 (or latest) to better support the Psuedoconsole API and applications like Windows Terminal. I fall back to the older flags otherwise.

Major goals:

Replace Semaphores with CriticalSections. CriticalSections are scoped to a single process and are generally faster than Semaphores which are shared between processes.

Replace the pattern of loading libraries and testing for functions to see if an function is available. Use version helpers instead to access newer APIs or fallback to older APIs.

Have background threads for stdio and use Overlapping IO and IO Completion Ports in other cases.

Things to investigate:

Adding epoll and kqueue support. Using the wepoll library for Windows that implements the epoll API for sockets.

Using the ThreadPool API for I/O threads. This might mean moving the API target to Vista and Server 2008

It's funny how you find an answer to a question right after you make a public post about things.

In the current code, there is a check on _WIN32_WINNT being less than 0x602 and if it is, redefining it to be 0x602. That version refers to Windows 8. So, the library as it stands probably wouldn't work on Windows 7 or earlier. Now, it "might" because of some trickery, but it probably actually doesn't do the right thing in some cases.

So it seems Windows 8 is a fine API target.

Nathan