Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51850 - sandbox/synchro/boost/synchro/lockable
From: vicente.botet_at_[hidden]
Date: 2009-03-18 19:19:34


Author: viboes
Date: 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
New Revision: 51850
URL: http://svn.boost.org/trac/boost/changeset/51850

Log:
0.3.0 : Adding lock_until/for try_lock_until/for free functions + usage of Boost/Chrono

Text files modified:
   sandbox/synchro/boost/synchro/lockable/lock.hpp | 8 --------
   sandbox/synchro/boost/synchro/lockable/lock_for.hpp | 8 ++++----
   sandbox/synchro/boost/synchro/lockable/lock_shared_for.hpp | 6 +++---
   sandbox/synchro/boost/synchro/lockable/lock_shared_until.hpp | 4 ++--
   sandbox/synchro/boost/synchro/lockable/lock_until.hpp | 4 ++--
   sandbox/synchro/boost/synchro/lockable/lock_upgrade_for.hpp | 6 +++---
   6 files changed, 14 insertions(+), 22 deletions(-)

Modified: sandbox/synchro/boost/synchro/lockable/lock.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/lock.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/lock.hpp 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
@@ -13,9 +13,6 @@
 
 #include <boost/config/abi_prefix.hpp>
 
-//!\file
-//!Describes a generic free lock function that can be applied to any model of the Lockable concept
-
 namespace boost { namespace synchro { namespace lockable {
 
     namespace result_of {
@@ -34,11 +31,6 @@
         };
     }
 
- //!Effects: The calling thread tries to obtain ownership of the lockable, and
- //! if another thread has ownership of the lockable, it waits until it can
- //! obtain the ownership. If a thread takes ownership of the lockable the
- //! lockable must be unlocked by the same thread.
- //!Throws: boost::system_exception on error.
     template <typename Lockable>
     typename result_of::template lock<Lockable>::type
     lock(Lockable& lockable) {

Modified: sandbox/synchro/boost/synchro/lockable/lock_for.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/lock_for.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/lock_for.hpp 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
@@ -26,17 +26,17 @@
     namespace partial_specialization_workaround {
         template <typename Lockable, class Rep, class Period >
         struct lock_for {
- static void
+ static typename result_of::template lock_for<Lockable>::type
             apply( Lockable& lockable, const chrono::duration<Rep, Period>& rel_time ) {
- lockable.lock_for(rel_time);
+ return lockable.lock_for(rel_time);
             }
         };
     }
 
     template <typename Lockable, class Rep, class Period >
- void
+ typename result_of::template lock_for<Lockable>::type
     lock_for(Lockable& lockable, const chrono::duration<Rep, Period>& abs_time) {
- partial_specialization_workaround::lock_for<Lockable,Rep,Period>::apply(lockable, abs_time);
+ return partial_specialization_workaround::lock_for<Lockable,Rep,Period>::apply(lockable, abs_time);
     }
 
 

Modified: sandbox/synchro/boost/synchro/lockable/lock_shared_for.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/lock_shared_for.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/lock_shared_for.hpp 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
@@ -17,7 +17,7 @@
 namespace boost { namespace synchro { namespace lockable {
 
     namespace result_of {
- template <typename Lockable>
+ template <typename Lockable, class Rep, class Period >
         struct lock_shared_for {
             typedef void type;
         };
@@ -26,7 +26,7 @@
     namespace partial_specialization_workaround {
         template <typename Lockable, class Rep, class Period >
         struct lock_shared_for {
- static void
+ static typename result_of::template lock_shared_for<Lockable,Rep,Period>::type
             apply( Lockable& lockable, const chrono::duration<Rep, Period>& rel_time ) {
                 return lockable.lock_shared_for(rel_time);
             }
@@ -34,7 +34,7 @@
     }
 
     template <typename Lockable, class Rep, class Period >
- void
+ typename result_of::template lock_shared_for<Lockable,Rep,Period>::type
     lock_shared_for(Lockable& lockable, const chrono::duration<Rep, Period>& abs_time) {
         return partial_specialization_workaround::lock_shared_for<Lockable,Rep,Period>::apply(lockable, abs_time);
     }

Modified: sandbox/synchro/boost/synchro/lockable/lock_shared_until.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/lock_shared_until.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/lock_shared_until.hpp 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
@@ -26,7 +26,7 @@
     namespace partial_specialization_workaround {
         template <typename Lockable, class Clock, class Duration >
         struct lock_shared_until {
- static void
+ static typename result_of::template lock_shared_until<Lockable,Clock,Duration>::type
             apply( Lockable& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
                 return lockable.lock_shared_until(abs_time);
             }
@@ -34,7 +34,7 @@
     }
 
     template <typename Lockable, class Clock, class Duration >
- void
+ typename result_of::template lock_shared_until<Lockable,Clock,Duration>::type
     lock_shared_until(Lockable& lockable, const chrono::time_point<Clock, Duration>& abs_time) {
         return partial_specialization_workaround::lock_shared_until<Lockable,Clock,Duration>::apply(lockable, abs_time);
     }

Modified: sandbox/synchro/boost/synchro/lockable/lock_until.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/lock_until.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/lock_until.hpp 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
@@ -26,7 +26,7 @@
     namespace partial_specialization_workaround {
         template <typename Lockable, class Clock, class Duration >
         struct lock_until {
- static void
+ static typename result_of::template lock_until<Lockable,Clock,Duration>::type
             apply( Lockable& lockable, const chrono::time_point<Clock, Duration>& abs_time ) {
                 return lockable.lock_until(abs_time);
             }
@@ -34,7 +34,7 @@
     }
 
     template <typename Lockable, class Clock, class Duration >
- void
+ typename result_of::template lock_until<Lockable,Clock,Duration>::type
     lock_until(Lockable& lockable, const chrono::time_point<Clock, Duration>& abs_time) {
         return partial_specialization_workaround::lock_until<Lockable,Clock,Duration>::apply(lockable, abs_time);
     }

Modified: sandbox/synchro/boost/synchro/lockable/lock_upgrade_for.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable/lock_upgrade_for.hpp (original)
+++ sandbox/synchro/boost/synchro/lockable/lock_upgrade_for.hpp 2009-03-18 19:19:31 EDT (Wed, 18 Mar 2009)
@@ -17,7 +17,7 @@
 namespace boost { namespace synchro { namespace lockable {
 
     namespace result_of {
- template <typename Lockable>
+ template <typename Lockable, class Rep, class Period >
         struct lock_upgrade_for {
             typedef void type;
         };
@@ -26,7 +26,7 @@
     namespace partial_specialization_workaround {
         template <typename Lockable, class Rep, class Period >
         struct lock_upgrade_for {
- static void
+ static typename result_of::template lock_upgrade_for<Lockable,Rep, Period>::type
             apply( Lockable& lockable, const chrono::duration<Rep, Period>& rel_time ) {
                 return lockable.lock_upgrade_for(rel_time);
             }
@@ -34,7 +34,7 @@
     }
 
     template <typename Lockable, class Rep, class Period >
- void
+ typename result_of::template lock_upgrade_for<Lockable,Rep, Period>::type
     lock_upgrade_for(Lockable& lockable, const chrono::duration<Rep, Period>& abs_time) {
         return partial_specialization_workaround::lock_upgrade_for<Lockable,Rep,Period>::apply(lockable, abs_time);
     }


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