Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52051 - in sandbox/synchro/boost/synchro: . lockable lockables/detail lockers poly process
From: vicente.botet_at_[hidden]
Date: 2009-03-29 12:57:39


Author: viboes
Date: 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
New Revision: 52051
URL: http://svn.boost.org/trac/boost/changeset/52051

Log:
0.3.1 : Usage of Boost/Chrono

Removed:
   sandbox/synchro/boost/synchro/lockers/priority_write.hpp
Text files modified:
   sandbox/synchro/boost/synchro/condition_lockable.hpp | 25 +++++++++-------
   sandbox/synchro/boost/synchro/condition_safe.hpp | 28 ++++++++++--------
   sandbox/synchro/boost/synchro/lockable/functions.hpp | 4 ++
   sandbox/synchro/boost/synchro/lockable_adapter.hpp | 36 ------------------------
   sandbox/synchro/boost/synchro/lockable_concepts.hpp | 2
   sandbox/synchro/boost/synchro/lockables/detail/try_lock_internal.hpp | 8 ++--
   sandbox/synchro/boost/synchro/locker_concepts.hpp | 17 +++++------
   sandbox/synchro/boost/synchro/lockers/condition_locker.hpp | 52 ++++++++++++++++++++---------------
   sandbox/synchro/boost/synchro/poly/lock.hpp | 37 -------------------------
   sandbox/synchro/boost/synchro/poly/lock_adapter.hpp | 36 ++++++++++--------------
   sandbox/synchro/boost/synchro/process/mutex.hpp | 16 ++++++----
   sandbox/synchro/boost/synchro/process/named_mutex.hpp | 39 +++++++++++++++++++++++++-
   sandbox/synchro/boost/synchro/process/named_recursive_mutex.hpp | 39 +++++++++++++++++++++++++-
   sandbox/synchro/boost/synchro/process/named_upgradable_mutex.hpp | 58 +++++++++++++++++++++++++++------------
   sandbox/synchro/boost/synchro/process/recursive_mutex.hpp | 40 ++++++++++++++++++++++++++-
   sandbox/synchro/boost/synchro/process/upgradable_mutex.hpp | 56 +++++++++++++++++++++++++++-----------
   sandbox/synchro/boost/synchro/semaphore.hpp | 26 +++++++++++------
   sandbox/synchro/boost/synchro/synchronized.hpp | 12 +++++--
   18 files changed, 316 insertions(+), 215 deletions(-)

Modified: sandbox/synchro/boost/synchro/condition_lockable.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/condition_lockable.hpp (original)
+++ sandbox/synchro/boost/synchro/condition_lockable.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -18,6 +18,8 @@
 #include <boost/synchro/condition_backdoor.hpp>
 #include <boost/synchro/condition_safe.hpp>
 #include <boost/synchro/timeout_exception.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
 
@@ -42,25 +44,26 @@
     void lock_when(condition &cond, Predicate pred){
         typename condition::backdoor(cond).wait_when(*this, pred);
     }
- template<typename Predicate>
+ template<typename Predicate, typename Clock, typename Duration>
     void lock_when_until(condition &cond, Predicate pred,
- boost::system_time const& abs_time){
+ chrono::time_point<Clock, Duration> const& abs_time){
         typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
     }
- template<typename Predicate, typename duration_type>
+ template<typename Predicate, typename Rep, typename Period>
     void lock_when_for(condition &cond, Predicate pred,
- duration_type const& rel_time){
+ chrono::duration<Rep, Period> const& rel_time){
         typename condition::backdoor(cond).wait_when_for(*this, pred, rel_time);
     }
         
     void relock_on(condition & cond) {
         typename condition::backdoor(cond).wait(*this);
     }
- void relock_on_until(condition & cond, boost::system_time const& abs_time) {
+ template<typename Clock, typename Duration>
+ void relock_on_until(condition & cond, chrono::time_point<Clock, Duration> const& abs_time) {
            typename condition::backdoor(cond).wait_until(*this, abs_time);
     }
- template<typename duration_type>
- void relock_on_for(condition & cond, duration_type const& rel_time) {
+ template< typename Rep, typename Period>
+ void relock_on_for(condition & cond, chrono::duration<Rep, Period> const& rel_time) {
         typename condition::backdoor(cond).wait_for(*this, rel_time);
     }
 
@@ -68,14 +71,14 @@
     void relock_when(condition &cond, Predicate pred){
         typename condition::backdoor(cond).wait_when(*this, pred);
     }
- template<typename Predicate>
+ template<typename Predicate, typename Clock, typename Duration>
     void relock_when_until(condition &cond, Predicate pred,
- boost::system_time const& abs_time){
+ chrono::time_point<Clock, Duration> const& abs_time){
         typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
     }
- template<typename Predicate, typename duration_type>
+ template<typename Predicate, typename Rep, typename Period>
     void relock_when_for(condition &cond, Predicate pred,
- duration_type const& rel_time){
+ chrono::duration<Rep, Period> const& rel_time){
         typename condition::backdoor(cond).wait_when_for(*this, pred, rel_time);
     }
 

Modified: sandbox/synchro/boost/synchro/condition_safe.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/condition_safe.hpp (original)
+++ sandbox/synchro/boost/synchro/condition_safe.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,6 +16,8 @@
 #include <boost/synchro/thread/mutex.hpp>
 #include <boost/synchro/detail/deleted_functions.hpp>
 #include <boost/synchro/detail/defaulted_functions.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
 
@@ -50,27 +52,27 @@
         cond_.wait(lock);
     }
 
- template <typename Locker>
- void wait_until(Locker& lock, boost::system_time const& abs_time) {
- if (!cond_.timed_wait(lock)) throw timeout_exception();
+ template <typename Locker, typename Clock, typename Duration>
+ void wait_until(Locker& lock, chrono::time_point<Clock, Duration> const& abs_time) {
+ if (!cond_.timed_wait(lock,boost::convert_to<posix_time::ptime>(abs_time))) throw timeout_exception();
     }
 
- template<typename Locker, typename duration_type>
- void wait_for(Locker& lock,duration_type const& rel_time) {
- if (!cond_.timed_wait(lock)) throw timeout_exception();
+ template<typename Locker, typename Rep, typename Period>
+ void wait_for(Locker& lock,chrono::duration<Rep, Period> const& rel_time) {
+ if (!cond_.timed_wait(lock, boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
     }
 
 // template<typename Locker, typename predicate_type>
 // bool wait_when(Locker& lock, predicate_type pred) {
 // return cond_.wait(lock, pred);
 // }
- template<typename Locker, typename predicate_type>
- void wait_when_until(Locker& lock, predicate_type pred, boost::system_time const& abs_time) {
- if (!cond_.timed_wait(lock, pred, abs_time)) throw timeout_exception();
- }
- template<typename Locker, typename duration_type, typename predicate_type>
- void wait_when_for(Locker& lock, predicate_type pred, duration_type const& rel_time) {
- if (!cond_.timed_wait(lock, pred, rel_time)) throw timeout_exception();
+ template<typename Locker, typename predicate_type, typename Clock, typename Duration>
+ void wait_when_until(Locker& lock, predicate_type pred, chrono::time_point<Clock, Duration> const& abs_time) {
+ if (!cond_.timed_wait(lock, pred, boost::convert_to<posix_time::ptime>(abs_time))) throw timeout_exception();
+ }
+ template<typename Locker, typename predicate_type, typename Rep, typename Period>
+ void wait_when_for(Locker& lock, predicate_type pred, chrono::duration<Rep, Period> const& rel_time) {
+ if (!cond_.timed_wait(lock, pred, boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
     }
 private:
     Condition cond_;

Modified: sandbox/synchro/boost/synchro/lockable/functions.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/functions.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/functions.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -68,6 +68,10 @@
 #include <boost/synchro/lockable/lock_when_until.hpp>
 #include <boost/synchro/lockable/lock_when_for.hpp>
 
+#include <boost/synchro/lockable/relock_on.hpp>
+#include <boost/synchro/lockable/relock_on_until.hpp>
+#include <boost/synchro/lockable/relock_on_for.hpp>
+
 #include <boost/synchro/lockable/relock_when.hpp>
 #include <boost/synchro/lockable/relock_when_until.hpp>
 #include <boost/synchro/lockable/relock_when_for.hpp>

Modified: sandbox/synchro/boost/synchro/lockable_adapter.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable_adapter.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable_adapter.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -55,12 +55,6 @@
 
     timed_lockable_adapter() {}
 
- bool try_lock_until(system_time const & abs_time)
- {return the_lock().try_lock_until(abs_time);}
- template<typename TimeDuration>
- bool try_lock_for(TimeDuration const & relative_time)
- {return the_lock().try_lock_for(relative_time);}
-
     template<typename Clock, typename Duration>
     bool try_lock_until(chrono::time_point<Clock, Duration> const & abs_time)
     {return the_lock().try_lock_until(abs_time);}
@@ -68,16 +62,10 @@
     bool try_lock_for(chrono::duration<Rep, Period> const & rel_time)
     {return the_lock().try_lock_for(rel_time);}
     
- void lock_until(system_time const & abs_time)
- {the_lock().lock_until(abs_time);}
- template<typename TimeDuration>
- void lock_for(TimeDuration const & relative_time)
- {the_lock().lock_for(relative_time);}
 
     template<typename Clock, typename Duration>
     void lock_until(chrono::time_point<Clock, Duration> const & abs_time)
     {the_lock().lock_until(abs_time);}
-
     template<typename Rep, typename Period>
     void lock_for(chrono::duration<Rep, Period> const & rel_time)
     {the_lock().lock_for(rel_time);}
@@ -104,12 +92,6 @@
     void unlock_shared()
     {the_lock().unlock_shared();}
 
- bool try_lock_shared_until(system_time const& t)
- {return the_lock().try_lock_shared_until(t);}
- template<typename TimeDuration>
- bool try_lock_shared_for(TimeDuration const& t)
- {return the_lock().try_lock_shared_for(t);}
-
     template<typename Clock, typename Duration>
     bool try_lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
     {return the_lock().try_lock_shared_until(abs_time);}
@@ -117,12 +99,6 @@
     bool try_lock_shared_for(chrono::duration<Rep, Period> const & rel_time)
     {return the_lock().try_lock_shared_for(rel_time);}
     
- template<typename TimeDuration>
- void lock_shared_for(TimeDuration const& t)
- {the_lock().lock_shared_for(t);}
- void lock_shared_until(system_time const& t)
- {the_lock().lock_shared_until(t);}
-
     template<typename Clock, typename Duration>
     void lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
     {the_lock().lock_shared_until(abs_time);}
@@ -163,30 +139,18 @@
     {the_lock().unlock_and_lock_shared();}
     void unlock_upgrade_and_lock_shared()
     {the_lock().unlock_upgrade_and_lock_shared();}
- bool try_lock_upgrade_until(system_time const&t)
- {return the_lock().try_lock_upgrade_until(t);}
- template<typename TimeDuration>
- bool try_lock_upgrade_for(TimeDuration const&t)
- {return the_lock().try_lock_upgrade_for(t);}
     
     template<typename Clock, typename Duration>
     bool try_lock_upgrade_until(chrono::time_point<Clock, Duration> const & abs_time)
     {return the_lock().try_lock_upgrade_until(abs_time);}
-
     template<typename Rep, typename Period>
     bool try_lock_upgrade_for(chrono::duration<Rep, Period> const & rel_time)
     {return the_lock().try_lock_upgrade_for(rel_time);}
     
- void lock_upgrade_until(system_time const&t)
- {the_lock().lock_upgrade_until(t);}
- template<typename TimeDuration>
- void lock_upgrade_for(TimeDuration const&t)
- {the_lock().lock_upgrade_for(t);}
 
     template<typename Clock, typename Duration>
     void lock_upgrade_until(chrono::time_point<Clock, Duration> const & abs_time)
     {the_lock().lock_upgrade_until(abs_time);}
-
     template<typename Rep, typename Period>
     void lock_upgrade_for(chrono::duration<Rep, Period> const & rel_time)
     {the_lock().try_lock_upgrade_for(rel_time);}

Modified: sandbox/synchro/boost/synchro/lockable_concepts.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable_concepts.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable_concepts.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -87,7 +87,7 @@
     }
     Lockable& l;
     Condition c;
- system_time t;
+ boost::chrono::system_clock::time_point t;
 };
       
 

Modified: sandbox/synchro/boost/synchro/lockables/detail/try_lock_internal.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockables/detail/try_lock_internal.hpp (original)
+++ sandbox/synchro/boost/synchro/lockables/detail/try_lock_internal.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,7 +16,7 @@
         template<typename MutexType1,typename MutexType2>
         unsigned try_lock_internal(MutexType1& m1,MutexType2& m2)
         {
- unique_locker<MutexType1> l1(m1,boost::try_to_lock);
+ unique_locker<MutexType1> l1(m1,boost::synchro::try_to_lock);
             if(!l1)
             {
                 return 1;
@@ -32,7 +32,7 @@
         template<typename MutexType1,typename MutexType2,typename MutexType3>
         unsigned try_lock_internal(MutexType1& m1,MutexType2& m2,MutexType3& m3)
         {
- unique_locker<MutexType1> l1(m1,boost::try_to_lock);
+ unique_locker<MutexType1> l1(m1,boost::synchro::try_to_lock);
             if(!l1)
             {
                 return 1;
@@ -51,7 +51,7 @@
         unsigned try_lock_internal(MutexType1& m1,MutexType2& m2,MutexType3& m3,
                                    MutexType4& m4)
         {
- unique_locker<MutexType1> l1(m1,boost::try_to_lock);
+ unique_locker<MutexType1> l1(m1,boost::synchro::try_to_lock);
             if(!l1)
             {
                 return 1;
@@ -69,7 +69,7 @@
         unsigned try_lock_internal(MutexType1& m1,MutexType2& m2,MutexType3& m3,
                                    MutexType4& m4,MutexType5& m5)
         {
- unique_locker<MutexType1> l1(m1,boost::try_to_lock);
+ unique_locker<MutexType1> l1(m1,boost::synchro::try_to_lock);
             if(!l1)
             {
                 return 1;

Modified: sandbox/synchro/boost/synchro/locker_concepts.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/locker_concepts.hpp (original)
+++ sandbox/synchro/boost/synchro/locker_concepts.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,6 +16,7 @@
 #include <boost/date_time/posix_time/ptime.hpp>
 #include <boost/concept_check.hpp>
 #include <boost/thread/thread_time.hpp>
+#include <boost/chrono/chrono.hpp>
 
 namespace boost { namespace synchro {
 
@@ -38,7 +39,6 @@
         if (!l1) return;
     }
     lockable_type mtx_;
- system_time t;
 };
 
 template <typename Locker>
@@ -56,7 +56,6 @@
         //l2.release();
     }
     lockable_type mtx_;
- system_time t;
 };
 
 template <typename Locker>
@@ -66,20 +65,20 @@
 
     BOOST_CONCEPT_USAGE(TimedLockerConcept) {
         Locker l1(mtx_, t);
- Locker l2(mtx_, boost::posix_time::seconds(1));
+ Locker l2(mtx_, chrono::seconds(1));
         Locker l3(mtx_, t, throw_timeout);
- Locker l4(mtx_, boost::posix_time::seconds(1), throw_timeout);
+ Locker l4(mtx_, chrono::seconds(1), throw_timeout);
         Locker l5(t, mtx_);
- Locker l6(boost::posix_time::seconds(1), mtx_);
+ Locker l6(chrono::seconds(1), mtx_);
         Locker l7(nothrow_timeout, t, mtx_);
- Locker l8(nothrow_timeout, boost::posix_time::seconds(1), mtx_);
+ Locker l8(nothrow_timeout, chrono::seconds(1), mtx_);
         l5.lock_until(t);
- l5.lock_for(boost::posix_time::seconds(1));
+ l5.lock_for(chrono::seconds(1));
         if (l5.try_lock_until(t)) return;
- if (l5.try_lock_for(boost::posix_time::seconds(1))) return;
+ if (l5.try_lock_for(chrono::seconds(1))) return;
     }
     lockable_type mtx_;
- system_time t;
+ boost::chrono::system_clock::time_point t;
 };
 
 

Modified: sandbox/synchro/boost/synchro/lockers/condition_locker.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockers/condition_locker.hpp (original)
+++ sandbox/synchro/boost/synchro/lockers/condition_locker.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -17,6 +17,8 @@
 #include <boost/synchro/condition_backdoor.hpp>
 #include <boost/synchro/condition_safe.hpp>
 #include <boost/synchro/lockers.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
 
@@ -49,15 +51,17 @@
     bool is_locking(lockable_type* l) const /*< strict lockers specific function >*/
 
     void relock_on(condition & cond);
- void relock_until(condition & cond, boost::system_time const& abs_time);
+ template<typename Clock, typename Duration>
+ void relock_until(condition & cond, chrono::time_point<Clock, Duration> const& abs_time);
     template<typename duration_type>
     void relock_on_for(condition & cond, duration_type const& rel_time);
 
     template<typename Predicate>
     void relock_when(condition &cond, Predicate pred);
     template<typename Predicate>
+ template<typename Clock, typename Duration>
     void relock_when_until(condition &cond, Predicate pred,
- boost::system_time const& abs_time);
+ chrono::time_point<Clock, Duration> const& abs_time);
     template<typename Predicate, typename duration_type>
     void relock_when_for(condition &cond, Predicate pred,
             duration_type const& rel_time);
@@ -86,11 +90,12 @@
     explicit condition_unique_locker(lockable_type& obj)
         : super_type(obj) { } /*< locks on construction >*/
 
- template<typename TimeDuration>
- condition_unique_locker(TimeDuration const& target_time, lockable_type& m_)
+ template<typename Rep, typename Period>
+ condition_unique_locker(chrono::duration<Rep, Period> const& target_time, lockable_type& m_)
         : super_type(target_time, m_)
     {}
- condition_unique_locker(system_time const& target_time, lockable_type& m_)
+ template<typename Clock, typename Duration>
+ condition_unique_locker(chrono::time_point<Clock, Duration> const& target_time, lockable_type& m_)
         : super_type(target_time, m_)
     {}
 
@@ -103,12 +108,13 @@
     // typename condition::backdoor(cond).wait(*static_cast<unique_lock<Lockable>*>(this)); /*< relock on condition >*/
     // }
 
- template<typename TimeDuration>
- condition_unique_locker(TimeDuration const& target_time, lockable_type& obj, condition &cond)
+ template<typename Rep, typename Period>
+ condition_unique_locker(chrono::duration<Rep, Period> const& target_time, lockable_type& obj, condition &cond)
         : super_type(obj) {
             typename condition::backdoor(cond).wait_for(target_time, *static_cast<super_type*>(this)); /*< relock on condition >*/
         }
- condition_unique_locker(system_time const& target_time, lockable_type& obj, condition &cond)
+ template<typename Clock, typename Duration>
+ condition_unique_locker(chrono::time_point<Clock, Duration> const& target_time, lockable_type& obj, condition &cond)
         : super_type(obj) {
             typename condition::backdoor(cond).wait_until(target_time, *static_cast<super_type*>(this)); /*< relock on condition >*/
         }
@@ -124,14 +130,14 @@
     // : super_type(obj) {
     // typename condition::backdoor(cond).wait_when(*static_cast<unique_lock<Lockable>*>(this), pred); /*< relock condition when predicate satisfaied>*/
     // }
- template <typename TimeDuration, typename Predicate>
- condition_unique_locker(TimeDuration const& target_time, lockable_type& obj, condition &cond, Predicate pred)
+ template <typename Rep, typename Period, typename Predicate>
+ condition_unique_locker(chrono::duration<Rep, Period> const& target_time, lockable_type& obj, condition &cond, Predicate pred)
         : super_type(obj) {
             typename condition::backdoor(cond).wait_when_for(*static_cast<super_type*>(this), pred, target_time); /*< relock condition when predicate satisfaied>*/
             //typename condition::backdoor(cond).wait_when(*this, pred); /*< relock condition when predicate satisfaied>*/
         }
- template <typename Predicate>
- condition_unique_locker(system_time const& target_time, lockable_type& obj, condition &cond, Predicate pred)
+ template <typename Predicate, typename Clock, typename Duration>
+ condition_unique_locker(chrono::time_point<Clock, Duration> const& target_time, lockable_type& obj, condition &cond, Predicate pred)
         : super_type(obj) {
             typename condition::backdoor(cond).wait_when_until(*static_cast<super_type*>(this), pred, target_time); /*< relock condition when predicate satisfaied>*/
             //typename condition::backdoor(cond).wait_when(*this, pred); /*< relock condition when predicate satisfaied>*/
@@ -152,10 +158,11 @@
     // typename condition::backdoor(cond).wait(*this);
     //}
 
- void relock_until(condition & cond, boost::system_time const& abs_time) {
+ template<typename Clock, typename Duration>
+ void relock_until(condition & cond, chrono::time_point<Clock, Duration> const& abs_time) {
            typename condition::backdoor(cond).wait_until(*this, abs_time);
     }
- //void relock_until(condition_boosted & cond, boost::system_time const& abs_time) {
+ //void relock_until(condition_boosted & cond, chrono::time_point<Clock, Duration> const& abs_time) {
     // typename condition::backdoor(cond).wait_until(*this, abs_time);
     //}
 
@@ -177,14 +184,14 @@
     // typename condition::backdoor(cond).wait_when(*this, pred);
     //}
 
- template<typename Predicate>
+ template <typename Predicate, typename Clock, typename Duration>
     void relock_when_until(condition &cond, Predicate pred,
- boost::system_time const& abs_time){
+ chrono::time_point<Clock, Duration> const& abs_time){
         typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
     }
     //template<typename Predicate>
     //void relock_when_until(condition_boosted &cond, Predicate pred,
- // boost::system_time const& abs_time){
+ // chrono::time_point<Clock, Duration> const& abs_time){
     // typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
     //}
 
@@ -270,10 +277,11 @@
     // typename condition::backdoor(cond).wait(*this);
     //}
 
- void relock_until(condition & cond, boost::system_time const& abs_time) {
+ template <typename Clock, typename Duration>
+ void relock_until(condition & cond, chrono::time_point<Clock, Duration> const& abs_time) {
            typename condition::backdoor(cond).wait_until(*this, abs_time);
     }
- //void relock_until(condition_boosted & cond, boost::system_time const& abs_time) {
+ //void relock_until(condition_boosted & cond, chrono::time_point<Clock, Duration> const& abs_time) {
     // typename condition::backdoor(cond).wait_until(*this, abs_time);
     //}
 
@@ -295,14 +303,14 @@
     // typename condition::backdoor(cond).wait_when(*this, pred);
     //}
 
- template<typename Predicate>
+ template <typename Predicate, typename Clock, typename Duration>
     void relock_when_until(condition &cond, Predicate pred,
- boost::system_time const& abs_time){
+ chrono::time_point<Clock, Duration> const& abs_time){
         typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
     }
     //template<typename Predicate>
     //void relock_when_until(condition_boosted &cond, Predicate pred,
- // boost::system_time const& abs_time){
+ // chrono::time_point<Clock, Duration> const& abs_time){
     // typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
     //}
 

Deleted: sandbox/synchro/boost/synchro/lockers/priority_write.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockers/priority_write.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
+++ (empty file)
@@ -1,411 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/synchro for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_SYNCHRO_CONDITION_LOCKER__HPP
-#define BOOST_SYNCHRO_CONDITION_LOCKER__HPP
-
-#include <boost/synchro/lockable_concepts.hpp>
-#include <boost/thread/condition.hpp>
-#include <boost/synchro/thread/mutex.hpp>
-
-namespace boost { namespace synchro {
-
-/* Write-Priority Read/Write Locks
-
-A write-priority read/write lock provides multiple threads with simultaneous
-read-only access to a protected resource, and a single thread with write access
-to the resource while excluding reads. When a writer releases a lock, other
-waiting writers will get the lock before any waiting reader. Write-priority
-read/write locks are usually used to protect resources that are more often
-read than written.
-
-A write-priority read/write lock has the rwlock_t data type. It must be
-initialized by the rwlock_init routine. The rwlock_lock_read routine locks the
-lock for a reader (multiple readers are allowed), the rwlock_unlock_read
-routine unlocks it. The rwlock_lock_write routine locks the lock for a writer,
-the rwlock_unlock_write routine unlocks it. The proper unlocking routine (for
-the reader or for the writer) must be called.
-
-In the following example, the lock owner is not checked. As a result, any
-thread can unlock any lock. Routines, such as the pthread_mutex_trylock
-subroutine, are missing and error handling is not performed, but cancelations
-are properly handled with cleanup handlers whenever required.
-
-*/
-
-struct pririty_write_mutex {
- struct state_data
- {
- int lock_count;
- bool exclusive;
- bool upgrade;
- bool exclusive_waiting_blocked;
- int waiting_writers;
- };
-
-
-
- state_data state;
- boost::mutex state_change;
- boost::condition_variable shared_cond;
- boost::condition_variable exclusive_cond;
- boost::condition_variable upgrade_cond;
-
- void release_waiters()
- {
- exclusive_cond.notify_one();
- shared_cond.notify_all();
- }
- int lock_count; /* < 0 .. held by writer */
- /* > 0 .. held by lock_count readers */
- /* = 0 .. held by nobody */
- int waiting_writers; /* count of wating writers */
-public:
- shared_mutex()
- {
- state_data state_={0,0,0,0};
- state=state_;
- }
-
- ~shared_mutex()
- {
- }
-
- void lock_shared()
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
-
- while(state.exclusive || state.exclusive_waiting_blocked)
- {
- shared_cond.wait(lock);
- }
- ++state.shared_count;
- }
-
- bool try_lock_shared()
- {
- boost::mutex::scoped_lock lock(state_change);
-
- if(state.exclusive || state.exclusive_waiting_blocked)
- {
- return false;
- }
- else
- {
- ++state.shared_count;
- return true;
- }
- }
-
- bool timed_lock_shared(system_time const& timeout)
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
-
- while(state.exclusive || state.exclusive_waiting_blocked)
- {
- if(!shared_cond.timed_wait(lock,timeout))
- {
- return false;
- }
- }
- ++state.shared_count;
- return true;
- }
-
- template<typename TimeDuration>
- bool timed_lock_shared(TimeDuration const & relative_time)
- {
- return timed_lock_shared(get_system_time()+relative_time);
- }
-
- void unlock_shared()
- {
- boost::mutex::scoped_lock lock(state_change);
- bool const last_reader=!--state.shared_count;
-
- if(last_reader)
- {
- if(state.upgrade)
- {
- state.upgrade=false;
- state.exclusive=true;
- upgrade_cond.notify_one();
- }
- else
- {
- state.exclusive_waiting_blocked=false;
- }
- release_waiters();
- }
- }
-
- void lock()
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
-
- while(state.shared_count || state.exclusive)
- {
- state.exclusive_waiting_blocked=true;
- exclusive_cond.wait(lock);
- }
- state.exclusive=true;
- }
-
- bool timed_lock(system_time const& timeout)
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
-
- while(state.shared_count || state.exclusive)
- {
- state.exclusive_waiting_blocked=true;
- if(!exclusive_cond.timed_wait(lock,timeout))
- {
- if(state.shared_count || state.exclusive)
- {
- state.exclusive_waiting_blocked=false;
- exclusive_cond.notify_one();
- return false;
- }
- break;
- }
- }
- state.exclusive=true;
- return true;
- }
-
- template<typename TimeDuration>
- bool timed_lock(TimeDuration const & relative_time)
- {
- return timed_lock(get_system_time()+relative_time);
- }
-
- bool try_lock()
- {
- boost::mutex::scoped_lock lock(state_change);
-
- if(state.shared_count || state.exclusive)
- {
- return false;
- }
- else
- {
- state.exclusive=true;
- return true;
- }
-
- }
-
- void unlock()
- {
- boost::mutex::scoped_lock lock(state_change);
- state.exclusive=false;
- state.exclusive_waiting_blocked=false;
- release_waiters();
- }
-
- void lock_upgrade()
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
- while(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
- {
- shared_cond.wait(lock);
- }
- ++state.shared_count;
- state.upgrade=true;
- }
-
- bool timed_lock_upgrade(system_time const& timeout)
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
- while(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
- {
- if(!shared_cond.timed_wait(lock,timeout))
- {
- if(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
- {
- return false;
- }
- break;
- }
- }
- ++state.shared_count;
- state.upgrade=true;
- return true;
- }
-
- template<typename TimeDuration>
- bool timed_lock_upgrade(TimeDuration const & relative_time)
- {
- return timed_lock(get_system_time()+relative_time);
- }
-
- bool try_lock_upgrade()
- {
- boost::mutex::scoped_lock lock(state_change);
- if(state.exclusive || state.exclusive_waiting_blocked || state.upgrade)
- {
- return false;
- }
- else
- {
- ++state.shared_count;
- state.upgrade=true;
- return true;
- }
- }
-
- void unlock_upgrade()
- {
- boost::mutex::scoped_lock lock(state_change);
- state.upgrade=false;
- bool const last_reader=!--state.shared_count;
-
- if(last_reader)
- {
- state.exclusive_waiting_blocked=false;
- release_waiters();
- }
- }
-
- void unlock_upgrade_and_lock()
- {
- boost::this_thread::disable_interruption do_not_disturb;
- boost::mutex::scoped_lock lock(state_change);
- --state.shared_count;
- while(state.shared_count)
- {
- upgrade_cond.wait(lock);
- }
- state.upgrade=false;
- state.exclusive=true;
- }
-
- void unlock_and_lock_upgrade()
- {
- boost::mutex::scoped_lock lock(state_change);
- state.exclusive=false;
- state.upgrade=true;
- ++state.shared_count;
- state.exclusive_waiting_blocked=false;
- release_waiters();
- }
-
- void unlock_and_lock_shared()
- {
- boost::mutex::scoped_lock lock(state_change);
- state.exclusive=false;
- ++state.shared_count;
- state.exclusive_waiting_blocked=false;
- release_waiters();
- }
-
- void unlock_upgrade_and_lock_shared()
- {
- boost::mutex::scoped_lock lock(state_change);
- state.upgrade=false;
- state.exclusive_waiting_blocked=false;
- release_waiters();
- }
-};
-void rwlock_init(rwlock_t *rwl)
-{
-}
-
-void waiting_reader_cleanup(void *arg)
-{
- rwlock_t *rwl;
-
- rwl = (rwlock_t *)arg;
- pthread_mutex_unlock(&rwl->lock);
-}
-
-void rwlock_lock_read(rwlock_t *rwl)
-{
- pthread_mutex_lock(&rwl->lock);
- pthread_cleanup_push(waiting_reader_cleanup, rwl);
- while ((rwl->lock_count < 0) && (rwl->waiting_writers))
- pthread_cond_wait(&rwl->rcond, &rwl->lock);
- rwl->lock_count++;
- /*
- * Note that the pthread_cleanup_pop subroutine will
- * execute the waiting_reader_cleanup routine
- */
- pthread_cleanup_pop(1);
-}
-
-void rwlock_unlock_read(rwlock_t *rwl)
-{
- pthread_mutex_lock(&rwl->lock);
- rwl->lock_count--;
- if (!rwl->lock_count)
- pthread_cond_signal(&rwl->wcond);
- pthread_mutex_unlock(&rwl->lock);
-}
-
-void waiting_writer_cleanup(void *arg)
-{
- rwlock_t *rwl;
-
- rwl = (rwlock_t *)arg;
- rwl->waiting_writers--;
- if ((!rwl->waiting_writers) && (rwl->lock_count >= 0))
- /*
- * This only happens if we have been canceled
- */
- pthread_cond_broadcast(&rwl->wcond);
- pthread_mutex_unlock(&rwl->lock);
-}
-
-void rwlock_lock_write(rwlock_t *rwl)
-{
- pthread_mutex_lock(&rwl->lock);
- rwl->waiting_writers++;
- pthread_cleanup_push(waiting_writer_cleanup, rwl);
- while (rwl->lock_count)
- pthread_cond_wait(&rwl->wcond, &rwl->lock);
- rwl->lock_count = -1;
- /*
- * Note that the pthread_cleanup_pop subroutine will
- * execute the waiting_writer_cleanup routine
- */
- pthread_cleanup_pop(1);
-}
-
-void rwlock_unlock_write(rwlock_t *rwl)
-{
- pthread_mutex_lock(&rwl->lock);
- l->lock_count = 0;
- if (!rwl->wating_writers)
- pthread_cond_broadcast(&rwl->rcond);
- else
- pthread_cond_signal(&rwl->wcond);
- pthread_mutex_unlock(&rwl->lock);
-}
-};
-
-/*
- * Readers are counted only. When the count reaches zero, a waiting writer may
- * take the lock. Only one writer can hold the lock. When the lock is released
- * by a writer, another writer is awakened, if there is one. Otherwise, all
- * waiting readers are awakened.
- *
- * The locking routines are cancelable, because they call the
- * pthread_cond_wait subroutine. Cleanup handlers are therefore registered
- * before calling the subroutine.
- */
-}
-}
-#endif

Modified: sandbox/synchro/boost/synchro/poly/lock.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/poly/lock.hpp (original)
+++ sandbox/synchro/boost/synchro/poly/lock.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -28,18 +28,6 @@
 
 struct timed_lock : exclusive_lock {
     virtual ~timed_lock()=0;
- virtual bool try_lock_until(boost::system_time const& abs_time)=0;
- template<typename DurationType>
- bool try_lock_for(DurationType const& rel_time)
- {
- return try_lock_until(get_system_time()+rel_time);
- }
- virtual bool lock_until(boost::system_time const& abs_time)=0;
- template<typename DurationType>
- bool lock_for(DurationType const& rel_time)
- {
- return lock_until(get_system_time()+rel_time);
- }
     virtual bool try_lock_until(chrono::system_clock::time_point const & abs_time)=0;
     virtual bool try_lock_for(chrono::nanoseconds const & relative_time)=0;
     virtual void lock_until(chrono::system_clock::time_point const & abs_time)=0;
@@ -53,18 +41,6 @@
     virtual ~sharable_lock();
     virtual void lock_shared()=0;
     virtual bool try_lock_shared()=0;
- virtual bool try_lock_shared_until(boost::system_time const& abs_time)=0;
- template<typename DurationType>
- bool try_lock_shared_for(DurationType const& rel_time)
- {
- return try_lock_shared_until(get_system_time()+rel_time);
- }
- virtual void lock_shared_until(boost::system_time const& abs_time)=0;
- template<typename DurationType>
- void lock_shared_for(DurationType const& rel_time)
- {
- lock_shared_until(get_system_time()+rel_time);
- }
     virtual void unlock_shared()=0;
     virtual bool try_lock_shared_until(chrono::system_clock::time_point const & abs_time)=0;
     virtual bool try_lock_shared_for(chrono::nanoseconds const & relative_time)=0;
@@ -78,19 +54,6 @@
     virtual ~upgradable_lock();
     virtual void lock_upgrade()=0;
     
- virtual bool try_lock_upgrade_until(system_time const&t)=0;
- template<typename TimeDuration>
- bool try_lock_upgrade_for(TimeDuration const&t)
- {
- return try_lock_upgrade_until(get_system_time()+t);
- }
-
- virtual void lock_upgrade_until(system_time const&t)=0;
- template<typename TimeDuration>
- void lock_upgrade_for(TimeDuration const&t)
- {
- lock_upgrade_until(get_system_time()+t);
- }
     virtual bool try_lock_upgrade_until(chrono::system_clock::time_point const & abs_time)=0;
     virtual bool try_lock_shared_for(chrono::nanoseconds const & relative_time)=0;
     virtual void lock_upgrade_until(chrono::system_clock::time_point const & abs_time)=0;

Modified: sandbox/synchro/boost/synchro/poly/lock_adapter.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/poly/lock_adapter.hpp (original)
+++ sandbox/synchro/boost/synchro/poly/lock_adapter.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -53,16 +53,14 @@
 {
 public:
     ~timed_lock_adapter() {}
- bool try_lock_until(boost::system_time const& abs_time)
+ bool try_lock_until(chrono::system_clock::time_point const& abs_time)
     {return the_lock().try_lock_until(abs_time);}
- template<typename DurationType>
- bool try_lock_for(DurationType const& rel_time)
+ bool try_lock_for(chrono::nanoseconds const& rel_time)
     {return try_lock_for(rel_time);}
- bool lock_until(boost::system_time const& abs_time)
- {return the_lock().lock_until(abs_time);}
- template<typename DurationType>
- bool lock_for(DurationType const& rel_time)
- {return lock_for(rel_time);}
+ void lock_until(chrono::system_clock::time_point const& abs_time)
+ {the_lock().lock_until(abs_time);}
+ void lock_for(chrono::nanoseconds const& rel_time)
+ {lock_for(rel_time);}
     
     template<typename Clock, typename Duration>
     bool try_lock_until(chrono::time_point<Clock, Duration> const & abs_time)
@@ -101,17 +99,15 @@
     void unlock_shared()
     {the_lock().unlock_shared();}
 
- bool try_lock_shared_until(system_time const& t)
+ bool try_lock_shared_until(chrono::system_clock::time_point const& t)
     {return the_lock().try_lock_shared_until(t);}
- template<typename TimeDuration>
- bool try_lock_shared_for(TimeDuration const& t)
+ bool try_lock_shared_for(chrono::nanoseconds const& t)
     {return the_lock().try_lock_shared_for(t);}
     
- template<typename TimeDuration>
- void lock_shared_for(TimeDuration const& t)
- {the_lock().lock_shared_for(t);}
- void lock_shared_until(system_time const& t)
+ void lock_shared_until(chrono::system_clock::time_point const& t)
     {the_lock().lock_shared_until(t);}
+ void lock_shared_for(chrono::nanoseconds const& t)
+ {the_lock().lock_shared_for(t);}
 
     template<typename Clock, typename Duration>
     bool try_lock_shared_until(chrono::time_point<Clock, Duration> const & abs_time)
@@ -157,15 +153,13 @@
 
     bool try_lock_upgrade()
     {return the_lock().try_lock_upgrade();}
- bool try_lock_upgrade_until(system_time const&t)
+ bool try_lock_upgrade_until(chrono::system_clock::time_point const&t)
     {return the_lock().try_lock_upgrade_until(t);}
- template<typename TimeDuration>
- bool try_lock_upgrade_for(TimeDuration const&t)
+ bool try_lock_upgrade_for(chrono::nanoseconds const&t)
     {return the_lock().try_lock_upgrade_for(t);}
- void lock_upgrade_until(system_time const&t)
+ void lock_upgrade_until(chrono::system_clock::time_point const&t)
     {the_lock().lock_upgrade_until(t);}
- template<typename TimeDuration>
- void lock_upgrade_for(TimeDuration const&t)
+ void lock_upgrade_for(chrono::nanoseconds const&t)
     {the_lock().lock_upgrade_for(t);}
 
     template<typename Clock, typename Duration>

Modified: sandbox/synchro/boost/synchro/process/mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/mutex.hpp (original)
+++ sandbox/synchro/boost/synchro/process/mutex.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -17,9 +17,11 @@
 #include <boost/synchro/process/lockable_scope_traits.hpp>
 #include <boost/synchro/timeout_exception.hpp>
 #include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
-
+#if 0
 class interprocess_mutex
 : public lock_traits_base<
     multi_process_tag,
@@ -56,7 +58,6 @@
 
 };
 
-
 template <>
 struct unique_lock_type<interprocess_mutex> {
     typedef boost::interprocess::scoped_lock<boost::interprocess::interprocess_mutex> type;
@@ -71,14 +72,15 @@
 struct upgrade_lock_type<interprocess_mutex> {
     typedef boost::interprocess::upgradable_lock<boost::interprocess::interprocess_mutex> type;
 };
+#endif
 #if 0
 template <>
 struct upgrade_to_unique_locker_type<interprocess_mutex> {
     typedef boost::interprocess::upgrade_to_unique_lock<boost::interprocess::interprocess_mutex> type;
 };
 #endif
-#if 1
-//typedef boost::interprocess::interprocess_mutex interprocess_mutex;
+
+typedef boost::interprocess::interprocess_mutex interprocess_mutex;
 
 template<>
 struct timed_interface_tag<boost::interprocess::interprocess_mutex> {
@@ -117,7 +119,7 @@
     typedef boost::interprocess::interprocess_condition type;
 };
 
-#endif
+
 
 namespace lockable {
     namespace partial_specialization_workaround {
@@ -132,7 +134,7 @@
         struct lock_for<boost::interprocess::interprocess_mutex,Rep, Period> {
             static void
             apply( boost::interprocess::interprocess_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
- if(!lockable.timed_lock(boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
+ if(!lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
             }
         };
         template <class Clock, class Duration >
@@ -146,7 +148,7 @@
         struct try_lock_for<boost::interprocess::interprocess_mutex,Rep, Period> {
             static typename result_of::template try_lock_for<boost::interprocess::interprocess_mutex,Rep, Period>::type
             apply( boost::interprocess::interprocess_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
- return lockable.timed_lock(boost::convert_to<posix_time::time_duration>(rel_time));
+ return lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time));
             }
         };
     }

Modified: sandbox/synchro/boost/synchro/process/named_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/named_mutex.hpp (original)
+++ sandbox/synchro/boost/synchro/process/named_mutex.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,8 +16,11 @@
 #include <boost/synchro/process/lockable_scope_traits.hpp>
 #include <boost/synchro/timeout_exception.hpp>
 #include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
+#if 0
 class named_mutex
 : public boost::interprocess::named_mutex,
     public lock_traits_base<
@@ -57,7 +60,8 @@
     void lock_for(TimeDuration const & relative_time)
     {if(!timed_lock(boost::get_system_time()+relative_time)) throw timeout_exception();}
 };
-#if 0
+#endif
+
 typedef boost::interprocess::named_mutex named_mutex;
 
 template<>
@@ -97,8 +101,39 @@
     typedef boost::interprocess::interprocess_condition type;
 };
 
+namespace lockable {
+ namespace partial_specialization_workaround {
+ template <class Clock, class Duration >
+ struct lock_until<boost::interprocess::named_mutex,Clock, Duration> {
+ static void
+ apply( boost::interprocess::named_mutex& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
+ if(!lockable.timed_lock(boost::convert_to<posix_time::ptime>(abs_time))) throw timeout_exception();
+ }
+ };
+ template <class Rep, class Period >
+ struct lock_for<boost::interprocess::named_mutex,Rep, Period> {
+ static void
+ apply( boost::interprocess::named_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
+ if(!lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
+ }
+ };
+ template <class Clock, class Duration >
+ struct try_lock_until<boost::interprocess::named_mutex,Clock, Duration> {
+ static typename result_of::template try_lock_until<boost::interprocess::named_mutex,Clock, Duration>::type
+ apply( boost::interprocess::named_mutex& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
+ return lockable.timed_lock(boost::convert_to<posix_time::ptime>(abs_time));
+ }
+ };
+ template <class Rep, class Period >
+ struct try_lock_for<boost::interprocess::named_mutex,Rep, Period> {
+ static typename result_of::template try_lock_for<boost::interprocess::named_mutex,Rep, Period>::type
+ apply( boost::interprocess::named_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
+ return lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time));
+ }
+ };
+ }
+}
 
-#endif
 
 }
 }

Modified: sandbox/synchro/boost/synchro/process/named_recursive_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/named_recursive_mutex.hpp (original)
+++ sandbox/synchro/boost/synchro/process/named_recursive_mutex.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,8 +16,11 @@
 #include <boost/synchro/process/lockable_scope_traits.hpp>
 #include <boost/synchro/timeout_exception.hpp>
 #include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
+#if 0
 class named_recursive_mutex
 : public boost::interprocess::named_recursive_mutex,
     public lock_traits_base<
@@ -57,8 +60,8 @@
     void lock_for(TimeDuration const & relative_time)
     {if(!timed_lock(relative_time)) throw timeout_exception();}
 };
+#endif
 
-#if 0
 typedef boost::interprocess::named_recursive_mutex named_recursive_mutex;
 
 template<>
@@ -98,7 +101,39 @@
     typedef boost::interprocess::interprocess_condition type;
 };
 
-#endif
+
+namespace lockable {
+ namespace partial_specialization_workaround {
+ template <class Clock, class Duration >
+ struct lock_until<boost::interprocess::named_recursive_mutex,Clock, Duration> {
+ static void
+ apply( boost::interprocess::named_recursive_mutex& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
+ if(!lockable.timed_lock(boost::convert_to<posix_time::ptime>(abs_time))) throw timeout_exception();
+ }
+ };
+ template <class Rep, class Period >
+ struct lock_for<boost::interprocess::named_recursive_mutex,Rep, Period> {
+ static void
+ apply( boost::interprocess::named_recursive_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
+ if(!lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
+ }
+ };
+ template <class Clock, class Duration >
+ struct try_lock_until<boost::interprocess::named_recursive_mutex,Clock, Duration> {
+ static typename result_of::template try_lock_until<boost::interprocess::named_recursive_mutex,Clock, Duration>::type
+ apply( boost::interprocess::named_recursive_mutex& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
+ return lockable.timed_lock(boost::convert_to<posix_time::ptime>(abs_time));
+ }
+ };
+ template <class Rep, class Period >
+ struct try_lock_for<boost::interprocess::named_recursive_mutex,Rep, Period> {
+ static typename result_of::template try_lock_for<boost::interprocess::named_recursive_mutex,Rep, Period>::type
+ apply( boost::interprocess::named_recursive_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
+ return lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time));
+ }
+ };
+ }
+}
 
 }
 }

Modified: sandbox/synchro/boost/synchro/process/named_upgradable_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/named_upgradable_mutex.hpp (original)
+++ sandbox/synchro/boost/synchro/process/named_upgradable_mutex.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -19,6 +19,7 @@
 
 namespace boost { namespace synchro {
 
+#if 0
 class interprocess_named_upgradable_mutex
     : public interprocess::named_upgradable_mutex,
       public lock_traits_base<
@@ -109,8 +110,6 @@
     void unlock_upgrade_and_lock_shared()
     {
         unlock_upgradable_and_lock_sharable();
-#if 0
-#endif
     }
     void unlock_upgrade_and_lock()
     {unlock_upgrade_and_lock();}
@@ -130,24 +129,47 @@
 #endif
 
 };
+#endif
+
+typedef interprocess::named_upgradable_mutex interprocess_named_upgradable_mutex;
 
 
-//template<>
-//struct timed_interface_tag<boost::synchro::named_upgradable_mutex> {
-// typedef has_timed_interface_tag type;
-//};
-//template<>
-//struct reentrancy_tag<boost::synchro::named_upgradable_mutex> {
-// typedef non_recursive_tag type;
-//};
-//template<>
-//struct category_tag<boost::synchro::named_upgradable_mutex> {
-// typedef upgradable_lock_tag type;
-//};
-//template<>
-//struct scope_tag<boost::synchro::named_upgradable_mutex> {
-// typedef multi_process_tag type;
-//};
+template<>
+struct timed_interface_tag<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef has_timed_interface_tag type;
+};
+template<>
+struct reentrancy_tag<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef non_recursive_tag type;
+};
+template<>
+struct category_tag<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef upgradable_lock_tag type;
+};
+template<>
+struct scope_tag<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef multi_process_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef kernel_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef named_tag type;
+};
+
+template <>
+struct best_condition<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef boost::interprocess::interprocess_condition type;
+};
+
+template <>
+struct best_condition_any<boost::synchro::interprocess_named_upgradable_mutex> {
+ typedef boost::interprocess::interprocess_condition type;
+};
 
 #if 0
 template<>

Modified: sandbox/synchro/boost/synchro/process/recursive_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/recursive_mutex.hpp (original)
+++ sandbox/synchro/boost/synchro/process/recursive_mutex.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,9 +16,12 @@
 #include <boost/synchro/process/lockable_scope_traits.hpp>
 #include <boost/synchro/timeout_exception.hpp>
 #include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 namespace boost { namespace synchro {
 
+#if 0
 class interprocess_recursive_mutex
 : public lock_traits_base<
     multi_process_tag,
@@ -55,7 +58,8 @@
     //{return timed_lock_shared(abs_time);}
 
 };
-#if 0
+#endif
+
 typedef boost::interprocess::interprocess_recursive_mutex interprocess_recursive_mutex;
 
 template<>
@@ -96,7 +100,39 @@
     typedef boost::interprocess::interprocess_condition type;
 };
 
-#endif
+namespace lockable {
+ namespace partial_specialization_workaround {
+ template <class Clock, class Duration >
+ struct lock_until<boost::interprocess::interprocess_recursive_mutex,Clock, Duration> {
+ static void
+ apply( boost::interprocess::interprocess_recursive_mutex& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
+ if(!lockable.timed_lock(boost::convert_to<posix_time::ptime>(abs_time))) throw timeout_exception();
+ }
+ };
+ template <class Rep, class Period >
+ struct lock_for<boost::interprocess::interprocess_recursive_mutex,Rep, Period> {
+ static void
+ apply( boost::interprocess::interprocess_recursive_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
+ if(!lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time))) throw timeout_exception();
+ }
+ };
+ template <class Clock, class Duration >
+ struct try_lock_until<boost::interprocess::interprocess_recursive_mutex,Clock, Duration> {
+ static typename result_of::template try_lock_until<boost::interprocess::interprocess_recursive_mutex,Clock, Duration>::type
+ apply( boost::interprocess::interprocess_recursive_mutex& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
+ return lockable.timed_lock(boost::convert_to<posix_time::ptime>(abs_time));
+ }
+ };
+ template <class Rep, class Period >
+ struct try_lock_for<boost::interprocess::interprocess_recursive_mutex,Rep, Period> {
+ static typename result_of::template try_lock_for<boost::interprocess::interprocess_recursive_mutex,Rep, Period>::type
+ apply( boost::interprocess::interprocess_recursive_mutex& lockable, const chrono::duration<Rep, Period>& rel_time ) {
+ return lockable.timed_lock(get_system_time()+boost::convert_to<posix_time::time_duration>(rel_time));
+ }
+ };
+ }
+}
+
 
 }
 }

Modified: sandbox/synchro/boost/synchro/process/upgradable_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/upgradable_mutex.hpp (original)
+++ sandbox/synchro/boost/synchro/process/upgradable_mutex.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -19,6 +19,7 @@
 
 namespace boost { namespace synchro {
 
+#if 0
 class interprocess_upgradable_mutex
 : public lock_traits_base<
     multi_process_tag,
@@ -119,23 +120,46 @@
 
 };
 
+#endif
+typedef interprocess::interprocess_upgradable_mutex interprocess_upgradable_mutex;
+
+template<>
+struct timed_interface_tag<boost::synchro::interprocess_upgradable_mutex> {
+ typedef has_timed_interface_tag type;
+};
+template<>
+struct reentrancy_tag<boost::synchro::interprocess_upgradable_mutex> {
+ typedef non_recursive_tag type;
+};
+template<>
+struct category_tag<boost::synchro::interprocess_upgradable_mutex> {
+ typedef upgradable_lock_tag type;
+};
+template<>
+struct scope_tag<boost::synchro::interprocess_upgradable_mutex> {
+ typedef multi_process_tag type;
+};
+
+template<>
+struct lifetime_tag<boost::interprocess::interprocess_upgradable_mutex> {
+ typedef kernel_lifetime_tag type;
+};
+
+template<>
+struct naming_tag<boost::interprocess::interprocess_upgradable_mutex> {
+ typedef anonymous_tag type;
+};
+
+template <>
+struct best_condition<boost::interprocess::interprocess_upgradable_mutex> {
+ typedef boost::interprocess::interprocess_condition type;
+};
+
+template <>
+struct best_condition_any<boost::interprocess::interprocess_upgradable_mutex> {
+ typedef boost::interprocess::interprocess_condition type;
+};
 
-//template<>
-//struct timed_interface_tag<boost::synchro::interprocess_upgradable_mutex> {
-// typedef has_timed_interface_tag type;
-//};
-//template<>
-//struct reentrancy_tag<boost::synchro::interprocess_upgradable_mutex> {
-// typedef non_recursive_tag type;
-//};
-//template<>
-//struct category_tag<boost::synchro::interprocess_upgradable_mutex> {
-// typedef upgradable_lock_tag type;
-//};
-//template<>
-//struct scope_tag<boost::synchro::interprocess_upgradable_mutex> {
-// typedef multi_process_tag type;
-//};
 
 #if 0
 template<>

Modified: sandbox/synchro/boost/synchro/semaphore.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/semaphore.hpp (original)
+++ sandbox/synchro/boost/synchro/semaphore.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -16,6 +16,8 @@
 #include <boost/synchro/thread_synchronization_family.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/detail/deleted_functions.hpp>
+#include <boost/convert_to/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/convert_to/chrono_duration_to_posix_time_duration.hpp>
 
 //!\file
 //!Describes a semaphore class for inter-process synchronization
@@ -67,19 +69,21 @@
     //!to the posted or the timeout expires. If the timeout expires, the
     //!function returns false. If the semaphore is posted the function
     //!returns true. If there is an error throws sem_exception
- inline bool try_wait_until(const system_time &abs_time);
+ template<typename Clock, typename Duration>
+ inline bool try_wait_until(chrono::time_point<Clock, Duration> const& abs_time);
     
- template<typename TimeDuration>
- inline bool try_wait_for(const TimeDuration &rel_time) {
- return try_wait_until(get_system_time()+rel_time);
+ template<typename Rep, typename Period>
+ inline bool try_wait_for(const chrono::duration<Rep, Period> &rel_time) {
+ return try_wait_until(Rep::now()+rel_time);
     }
     
- inline void wait_until(const system_time &abs_time) {
+ template<typename Clock, typename Duration>
+ inline void wait_until(chrono::time_point<Clock, Duration> const& abs_time) {
         if (!try_wait_until(abs_time)) throw timeout_exception();
     }
     
- template<typename TimeDuration>
- inline void wait_for(const TimeDuration &rel_time) {
+ template<typename Rep, typename Period>
+ inline void wait_for(const chrono::duration<Rep, Period> &rel_time) {
         if (!try_wait_until(rel_time)) throw timeout_exception();
     }
 
@@ -131,12 +135,14 @@
    return true;
 }
 
-template <typename ScopeTag>
-inline bool basic_semaphore<ScopeTag>::try_wait_until(const system_time &abs_time)
+
+template<class ScopeTag>
+template<class Clock, class Duration>
+inline bool basic_semaphore<ScopeTag>::try_wait_until(const chrono::time_point<Clock, Duration> &abs_time)
 {
    scoped_lock lock(m_mut);
    while(m_count == 0){
- if(!m_cond.timed_wait(lock, abs_time))
+ if(!m_cond.timed_wait(lock, boost::convert_to<posix_time::ptime>(abs_time)))
          return m_count != 0;
    }
    --m_count;

Modified: sandbox/synchro/boost/synchro/synchronized.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/synchronized.hpp (original)
+++ sandbox/synchro/boost/synchro/synchronized.hpp 2009-03-29 12:57:35 EDT (Sun, 29 Mar 2009)
@@ -11,8 +11,6 @@
 #ifndef BOOST_SYNCHRO_SYNCHRONIZED__HPP
 #define BOOST_SYNCHRO_SYNCHRONIZED__HPP
 
-#include <boost/synchro/thread/locks.hpp>
-
 namespace boost { namespace synchro { namespace detail {
     bool no_opt_false() {return false;}
 }}}
@@ -72,9 +70,15 @@
 #define adopt_synchronize_var(VAR, LOCKABLE) BOOST_ADOPT_SYNCHRONIZE_VAR(VAR, LOCKABLE)
 #define defer_synchronize_var(VAR, LOCKABLE) BOOST_DEFER_SYNCHRONIZE_VAR(VAR, LOCKABLE)
 #define try_to_synchronize_var(VAR, LOCKABLE) BOOST_TRY_TO_SYNCHRONIZE_VAR(VAR, LOCKABLE)
-#define try_to_synchronize_var_until(VAR, LOCKABLE, ABS_TIME) BOOST_TRY_TO_SYNCHRONIZE_VAR_UNTIL(LOCKABLE, ABS_TIME)
-#define synchronize_var_until(VAR, LOCKABLE, ABS_TIME) BOOST_SYNCHRONIZE_VAR_UNTIL(ABS_TIME, LOCKABLE)
+#define try_to_synchronize_var_until(VAR, LOCKABLE, ABS_TIME) BOOST_TRY_TO_SYNCHRONIZE_VAR_UNTIL(VAR, LOCKABLE, ABS_TIME)
+#define synchronize_var_until(VAR, LOCKABLE, ABS_TIME) BOOST_SYNCHRONIZE_VAR_UNTIL(VAR, ABS_TIME, LOCKABLE)
 
 #define synchronize_type(TYPE, VAR, LOCKABLE) BOOST_SYNCHRONIZE_TYPE(TYPE, VAR, LOCKABLE)
+#define adopt_synchronize_type(TYPE, VAR, LOCKABLE) BOOST_ADOPT_SYNCHRONIZE_VAR(TYPE, VAR, LOCKABLE)
+#define defer_synchronize_type(TYPE, VAR, LOCKABLE) BOOST_DEFER_SYNCHRONIZE_VAR(TYPE, VAR, LOCKABLE)
+#define try_to_synchronize_type(TYPE, VAR, LOCKABLE) BOOST_TRY_TO_SYNCHRONIZE_VAR(TYPE, VAR, LOCKABLE)
+#define try_to_synchronize_type_until(TYPE, VAR, LOCKABLE, ABS_TIME) BOOST_TRY_TO_SYNCHRONIZE_VAR_UNTIL(TYPE, VAR, LOCKABLE, ABS_TIME)
+#define synchronize_type_until(TYPE, VAR, LOCKABLE, ABS_TIME) BOOST_SYNCHRONIZE_VAR_UNTIL(TYPE, VAR, ABS_TIME, LOCKABLE)
+
 
 #endif


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