[Openmp-commits] [openmp] [OpenMP] Move KMP_CANCEL_THREADS control from preprocessor to CMake (PR #193681)
Mark Zhuang via Openmp-commits
openmp-commits at lists.llvm.org
Tue May 5 04:58:46 PDT 2026
================
@@ -327,6 +327,16 @@ if(LIBOMP_STATS)
set(LIBOMP_USE_STDCPPLIB TRUE)
endif()
+# Thread cancellation via pthread_cancel. Disabled on platforms that lack it
+# (Android, WASI) but can also be forced off via -DLIBOMP_USE_CANCEL_THREADS=OFF.
+if(ANDROID OR WASM)
+ set(LIBOMP_USE_CANCEL_THREADS_DEFAULT FALSE)
+else()
+ set(LIBOMP_USE_CANCEL_THREADS_DEFAULT TRUE)
+endif()
+set(LIBOMP_USE_CANCEL_THREADS "${LIBOMP_USE_CANCEL_THREADS_DEFAULT}" CACHE BOOL
+ "Enable thread cancellation via pthread_cancel?")
----------------
zqb-all wrote:
Thanks! I kept Android/WASM hardcoded since I'm not sure if the sysroot always reflects the real runtime there, a cross-compilation sysroot may advertise pthread_cancel even when the actual target runtime lacks it. For other platforms the default now uses check_symbol_exists(pthread_cancel). Done in the follow-up patch.
https://github.com/llvm/llvm-project/pull/193681
More information about the Openmp-commits
mailing list