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

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 23 05:05:56 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)
----------------
mstorsjo wrote:

Does Cygwin provide `sched_getaffinity` and such APIs? (The other changes above mostly take various pthread APIs into use, which looks reasonable, but this I'd like to doublecheck.)

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


More information about the llvm-commits mailing list