Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2008-04-18 06:14:23


Author: johnmaddock
Date: 2008-04-18 06:14:23 EDT (Fri, 18 Apr 2008)
New Revision: 44534
URL: http://svn.boost.org/trac/boost/changeset/44534

Log:
Update thread tests: allow thread creation to fail at runtime.
Text files modified:
   trunk/libs/config/test/boost_has_pthreads.ipp | 14 ++++++++++++--
   1 files changed, 12 insertions(+), 2 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-18 06:14:23 EDT (Fri, 18 Apr 2008)
@@ -25,19 +25,29 @@
    int result = pthread_mutex_init(&mut, 0);
    if(0 == result)
    {
+ //
+ // Failure to be able to create and use a mutex
+ // is always a failure, even if the pthread
+ // library is just a non-functioning stub.
+ //
       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:
+ // Try and create a thread, this is allowed
+ // to fail, in case we are linking to a pthread
+ // "stub" library.
       //
       pthread_t t;
       int r = pthread_create(&t, 0, &thread_proc, 0);
- result |= r;
+ // result |= r;
       if(r == 0)
       {
+ //
+ // If we can create a thread, then we must be able to join to it:
+ //
          void* arg;
          r = pthread_join(t, &arg);
          result |= r;


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