cppcoro icon indicating copy to clipboard operation
cppcoro copied to clipboard

Windows 8/Server 12 is minimum due to WaitOnAddress/WakeByAddressAll

Open akoolenbourke opened this issue 6 years ago • 3 comments

I was doing some test integration of cppcoro into our product but linker errors meant we could not proceed due to the use of WaitOnAddress/WakeByAddressAll. We have a product with a significant number of users on post XP/2K3 but pre Windows 8 and we need to support those platforms.

NOTE: I will code a solution at some point if nothing official is implemented but I wanted to raise this as a potential issue.

akoolenbourke avatar Oct 30 '17 03:10 akoolenbourke

There should already be a fallback for pre-Windows 8 versions implemented for the lightweight_manual_reset_event class. It uses Win32 manual reset event kernel objects instead.

You need to define _WIN32_WINNT=0x0600 (or whatever your minimum API level is) before building/using cppcoro. If not defined then it will default to assuming Windows 10.

See https://github.com/lewissbaker/cppcoro/blob/7b786c0f9c2ba991e832395b3271e580f3e60c2f/include/cppcoro/detail/lightweight_manual_reset_event.hpp#L42-L48

See also https://github.com/lewissbaker/cppcoro/blob/7b786c0f9c2ba991e832395b3271e580f3e60c2f/include/cppcoro/config.hpp#L42-L60

lewissbaker avatar Oct 30 '17 04:10 lewissbaker

I do eventually want to support detecting Windows 8 at runtime rather than at compile time. eg. using GetProcAddress("WaitOnAddress") and using that if available and then falling back to CreateEvent() if needed.

lewissbaker avatar Oct 30 '17 04:10 lewissbaker

Ahh OK, thanks Lewis. I would have sworn we set that. Will check.

akoolenbourke avatar Oct 30 '17 06:10 akoolenbourke