[llvm] [LLVM][Support][Cygwin] Add threading support for Cygwin host (PR #145314)

Tomohiro Kashiwada via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 05:15:50 PDT 2025


================
@@ -316,7 +322,7 @@ static int computeHostNumHardwareThreads() {
   if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(mask),
                          &mask) == 0)
     return CPU_COUNT(&mask);
-#elif defined(__linux__)
+#elif (defined(__linux__) || defined(__CYGWIN__))
   cpu_set_t Set;
   CPU_ZERO(&Set);
   if (sched_getaffinity(0, sizeof(Set), &Set) == 0)
----------------
kikairoya wrote:

`sched_getaffinity` is declared in `<sched.h>` if `<sys/cpuset.h>` is included.

https://github.com/llvm/llvm-project/pull/145314


More information about the llvm-commits mailing list