From 0dcc2aeffb7998047a8bf56e0a057dd606f0a2c7 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Fri, 11 Apr 2008 09:21:08 +0000 Subject: [PATCH] Beefed up pthreads test cases. [SVN r44170] --- test/boost_has_pthreads.ipp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/test/boost_has_pthreads.ipp b/test/boost_has_pthreads.ipp index 1797b0b1..34374b61 100644 --- a/test/boost_has_pthreads.ipp +++ b/test/boost_has_pthreads.ipp @@ -14,17 +14,36 @@ namespace boost_has_pthreads{ +void* thread_proc(void* arg) +{ + return arg; +} + int test() { pthread_mutex_t mut; int result = pthread_mutex_init(&mut, 0); if(0 == result) { - pthread_mutex_lock(&mut); - pthread_mutex_unlock(&mut); - pthread_mutex_destroy(&mut); + result |= pthread_mutex_lock(&mut); + result |= pthread_mutex_unlock(&mut); + result |= pthread_mutex_trylock(&mut); + result |= pthread_mutex_unlock(&mut); + result |= pthread_mutex_destroy(&mut); + // + // Check that we can actually create a thread: + // + pthread_t t; + int r = pthread_create(&t, 0, &thread_proc, 0); + result |= r; + if(r == 0) + { + void* arg; + r = pthread_join(t, &arg); + result |= r; + } } - return 0; + return result; } }