Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/interprocess/sync/posix/recursive_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/recursive_mutex.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/interprocess/sync/posix/recursive_mutex.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -27,6 +27,14 @@ #ifndef BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_HPP #define BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_HPP +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + #include <boost/interprocess/detail/config_begin.hpp> #include <boost/interprocess/detail/workaround.hpp> @@ -38,7 +46,7 @@ #include <boost/interprocess/exceptions.hpp> #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> @@ -93,11 +101,12 @@ inline bool posix_recursive_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); @@ -107,22 +116,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 }