|
Boost-Commit : |
From: john_at_[hidden]
Date: 2008-04-11 05:21:08
Author: johnmaddock
Date: 2008-04-11 05:21:08 EDT (Fri, 11 Apr 2008)
New Revision: 44170
URL: http://svn.boost.org/trac/boost/changeset/44170
Log:
Beefed up pthreads test cases.
Text files modified:
trunk/libs/config/test/boost_has_pthreads.ipp | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
Modified: trunk/libs/config/test/boost_has_pthreads.ipp
==============================================================================
--- trunk/libs/config/test/boost_has_pthreads.ipp (original)
+++ trunk/libs/config/test/boost_has_pthreads.ipp 2008-04-11 05:21:08 EDT (Fri, 11 Apr 2008)
@@ -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;
}
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk