2
0
mirror of https://github.com/boostorg/thread.git synced 2026-02-11 12:12:12 +00:00

Thread: Merge from trunk

[SVN r80668]
This commit is contained in:
Vicente J. Botet Escriba
2012-09-23 12:38:00 +00:00
parent 12a1c7c71c
commit 2d8852199b
14 changed files with 342 additions and 96 deletions

View File

@@ -8,9 +8,20 @@
#ifndef BOOST_THREAD_CONFIG_WEK01032003_HPP
#define BOOST_THREAD_CONFIG_WEK01032003_HPP
// Force SIG_ATOMIC_MAX to be defined
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#ifdef BOOST_NO_NOEXCEPT
# define BOOST_THREAD_NOEXCEPT_OR_THROW throw()
#else
# define BOOST_THREAD_NOEXCEPT_OR_THROW noexcept
#endif
// This compiler doesn't support Boost.Chrono
#if defined __IBMCPP__ && (__IBMCPP__ < 1100) && ! defined BOOST_THREAD_DONT_USE_CHRONO
#define BOOST_THREAD_DONT_USE_CHRONO

View File

@@ -136,6 +136,10 @@ namespace boost
{
return ec_;
}
const char* what() const BOOST_THREAD_NOEXCEPT_OR_THROW
{
return code().message().c_str();
}
};

View File

@@ -12,17 +12,17 @@
#include <boost/thread/detail/config.hpp>
#include <pthread.h>
#include <boost/assert.hpp>
#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
#include <boost/cstdint.hpp>
#include <boost/thread/detail/delete.hpp>
// Force SIG_ATOMIC_MAX tobe defined
#define __STDC_LIMIT_MACROS
#include <csignal>
#include <boost/detail/no_exceptions_support.hpp>
#include <boost/assert.hpp>
#include <boost/config/abi_prefix.hpp>
#include <boost/cstdint.hpp>
#include <pthread.h>
#include <csignal>
namespace boost
{
@@ -92,21 +92,18 @@ namespace boost
if(flag.epoch==uninitialized_flag)
{
flag.epoch=being_initialized;
#ifndef BOOST_NO_EXCEPTIONS
try // BOOST_NO_EXCEPTIONS protected
BOOST_TRY
{
#endif
pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex);
f();
#ifndef BOOST_NO_EXCEPTIONS
}
catch(...) // BOOST_NO_EXCEPTIONS protected
BOOST_CATCH (...)
{
flag.epoch=uninitialized_flag;
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
throw; // BOOST_NO_EXCEPTIONS protected
BOOST_RETHROW
}
#endif
BOOST_CATCH_END
flag.epoch=--detail::once_global_epoch;
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
}