]> git.ipfire.org Git - thirdparty/curl.git/commit
build: stop detecting `sched_yield()` on Windows
authorViktor Szakats <commit@vsz.me>
Thu, 16 Jan 2025 19:39:13 +0000 (20:39 +0100)
committerViktor Szakats <commit@vsz.me>
Fri, 17 Jan 2025 22:31:58 +0000 (23:31 +0100)
commit2c4bfefe917c5f201ba1989de6bf2208b360c3ad
treebe3e677fdc9ee3bbfe86edb4c8016d251d8f4f60
parente49797abc24b8e0ac652d7aa0ceec7d252f9a019
build: stop detecting `sched_yield()` on Windows

On Windows a successful `sched_yield()` detection requires mingw-w64
built with POSIX threads (not Win32 threads) and GCC (not llvm/clang).
(linking to `winpthread` via custom options may also work.)

In CMake builds, it was pre-cached as unavailable before this patch.

When detected (via autotools), it got only used for Windows XP or older
targets combined with a non-GCC, non-clang compiler that doesn't support
`__builtin_ia32_pause()`, or with the Intel C compiler. According to
`lib/easy_lock.h`.

mingw-w64 only supports GCC and clang, leaving a very narrow chance when
`shed_yield()` gets called on Windows. Even then, `sched_yield()` is
implemented in `winpthread` as `Sleep(0)`, which may or not be a useful.
It's also trivial to implement locally if it is, and such rare build
combination is also deemed useful.

Thus, this patch marks `sched_yields()` permanently unavailable on the
Windows platform also with autotools, and instead of pre-caching, skip
this feature check with CMake.

This syncs `HAVE_SCHED_YIELDS` between builds methods on Windows.

Follow-up to 9b517c8b69a1f365fdb6f54f7153561182285b6c #11973
Follow-up to 23af112f5556d6a785c17e09f2422ac931405f61 #8680

Closes #16037
CMake/win32-cache.cmake
CMakeLists.txt
configure.ac