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
This commit is contained in:
Cristian Morales Vega
2019-11-16 04:27:14 +00:00
committed by Brad King
parent 25b7456f0e
commit b328cbaadb

View File

@@ -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);