Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/interprocess/sync/posix/mutex.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/interprocess/sync/posix/mutex.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/interprocess/sync/posix/mutex.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -27,7 +27,11 @@ #ifndef BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_HPP #define BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_HPP -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -44,7 +48,7 @@ #ifndef BOOST_INTERPROCESS_POSIX_TIMEOUTS # include <boost/interprocess/detail/os_thread_functions.hpp> -# include <boost/interprocess/sync/spin/wait.hpp> +# include <boost/interprocess/sync/detail/common_algorithms.hpp> #endif #include <boost/assert.hpp> @@ -103,12 +107,12 @@ inline bool posix_mutex::timed_lock(const boost::posix_time::ptime &abs_time) { + #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS + //Posix does not support infinity absolute time so handle it here if(abs_time == boost::posix_time::pos_infin){ this->lock(); return true; } - #ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS - timespec ts = ptime_to_timespec(abs_time); int res = pthread_mutex_timedlock(&m_mut, &ts); if (res != 0 && res != ETIMEDOUT) @@ -117,23 +121,7 @@ #else //BOOST_INTERPROCESS_POSIX_TIMEOUTS - //Obtain current count and target time - boost::posix_time::ptime now = microsec_clock::universal_time(); - - spin_wait swait; - do{ - if(this->try_lock()){ - break; - } - now = microsec_clock::universal_time(); - - if(now >= abs_time){ - return false; - } - // relinquish current time slice - swait.yield(); - }while (true); - return true; + return ipcdetail::try_based_timed_lock(*this, abs_time); #endif //BOOST_INTERPROCESS_POSIX_TIMEOUTS }