From b328cbaadb8b8d81a6d24d4ea071a8ba98a16e00 Mon Sep 17 00:00:00 2001 From: Cristian Morales Vega Date: Sat, 16 Nov 2019 04:27:14 +0000 Subject: FindThreads: Add pthread_cancel to program to test for pthreads in libc When using ThreadSanitizer our existing CMAKE_HAVE_LIBC_PTHREAD test program links using symbols from the tsan library. Among the symbols not provided by that library, `pthread_cancel()` seems to be the less risky symbol to add to the check. Fixes: #19981 --- Modules/FindThreads.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'Modules/FindThreads.cmake') diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 64576ebf56..85174d93d6 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -63,6 +63,7 @@ int main(void) pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); + pthread_cancel(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL); -- cgit v1.2.1