summaryrefslogtreecommitdiff
path: root/Modules/FindThreads.cmake
diff options
context:
space:
mode:
authorCristian Morales Vega <cristian@samknows.com>2019-11-16 04:27:14 +0000
committerBrad King <brad.king@kitware.com>2019-12-11 09:26:39 -0500
commitb328cbaadb8b8d81a6d24d4ea071a8ba98a16e00 (patch)
tree6ee13dcb4e020080cb85bab9d26f772c139fdb61 /Modules/FindThreads.cmake
parent25b7456f0e2301484ab74679886d006cf403b4b1 (diff)
downloadcmake-b328cbaadb8b8d81a6d24d4ea071a8ba98a16e00.tar.gz
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
Diffstat (limited to 'Modules/FindThreads.cmake')
-rw-r--r--Modules/FindThreads.cmake1
1 files changed, 1 insertions, 0 deletions
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);