$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r51243 - in sandbox/synchro/boost/synchro: . lockers process thread
From: vicente.botet_at_[hidden]
Date: 2009-02-14 03:53:14
Author: viboes
Date: 2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
New Revision: 51243
URL: http://svn.boost.org/trac/boost/changeset/51243
Log:
Boost.Synchro V0.0.0
Adding timeout exceptions
Added:
   sandbox/synchro/boost/synchro/condition_lockable.hpp   (contents, props changed)
   sandbox/synchro/boost/synchro/timeout_exception.hpp   (contents, props changed)
Text files modified: 
   sandbox/synchro/boost/synchro/lockable_adapter.hpp               |    21 +++++++++--                             
   sandbox/synchro/boost/synchro/lockers/strict_locker.hpp          |     2                                         
   sandbox/synchro/boost/synchro/process/mutex.hpp                  |     7 +++                                     
   sandbox/synchro/boost/synchro/process/named_mutex.hpp            |     8 +++                                     
   sandbox/synchro/boost/synchro/process/named_recursive_mutex.hpp  |     7 +++                                     
   sandbox/synchro/boost/synchro/process/named_upgradable_mutex.hpp |    15 +++++++-                                
   sandbox/synchro/boost/synchro/process/recursive_mutex.hpp        |     7 +++                                     
   sandbox/synchro/boost/synchro/process/upgradable_mutex.hpp       |    71 +++++++++++++++++++++++---------------- 
   sandbox/synchro/boost/synchro/thread/mutex.hpp                   |    17 ++++++---                               
   sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp         |    18 +++++-----                              
   sandbox/synchro/boost/synchro/thread/shared_mutex.hpp            |     9 +++++                                   
   11 files changed, 127 insertions(+), 55 deletions(-)
Added: sandbox/synchro/boost/synchro/condition_lockable.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/condition_lockable.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -0,0 +1,97 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_LOCKABLE__HPP
+#define BOOST_SYNCHRO_CONDITION_LOCKABLE__HPP
+
+#include <boost/synchro/lockable_concepts.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/interprocess/interprocess_condition.hpp>
+#include <boost/synchro/thread/mutex.hpp>
+#include <boost/synchro/condition_backdoor.hpp>
+#include <boost/synchro/condition_safe.hpp>
+#include <boost/synchro/timeout_exception.hpp>
+
+namespace boost { namespace synchro {
+
+//[condition_lockable
+template <
+    typename Lockable=thread_mutex,
+    class Condition=condition_safe<typename best_condition<Lockable>::type >
+>
+class condition_lockable;
+
+template <typename Lockable, class Condition >
+class condition_lockable : public Lockable {
+    BOOST_CONCEPT_ASSERT((LockableConcept<Lockable>));
+public:
+    typedef Lockable lockable_type;
+    typedef Condition condition;
+
+    condition_lockable() {}
+    ~condition_lockable() {}
+  
+    template<typename Predicate>
+    void lock_when(condition &cond, Predicate pred){
+        typename condition::backdoor(cond).wait_when(*this, pred);
+    }
+    template<typename Predicate>
+    void lock_when_until(condition &cond, Predicate pred,
+            boost::system_time const& abs_time){
+        typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
+    }
+    template<typename Predicate, typename duration_type>
+    void lock_when_for(condition &cond, Predicate pred,
+            duration_type 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) {
+           typename condition::backdoor(cond).wait_until(*this, abs_time);
+    }
+    template<typename duration_type>
+    void relock_on_for(condition & cond, duration_type const& rel_time) {
+        typename condition::backdoor(cond).wait_for(*this, rel_time);
+    }
+
+    template<typename Predicate>
+    void relock_when(condition &cond, Predicate pred){
+        typename condition::backdoor(cond).wait_when(*this, pred);
+    }
+    template<typename Predicate>
+    void relock_when_until(condition &cond, Predicate pred,
+            boost::system_time const& abs_time){
+        typename condition::backdoor(cond).wait_when_until(*this, pred, abs_time);
+    }
+    template<typename Predicate, typename duration_type>
+    void relock_when_for(condition &cond, Predicate pred,
+            duration_type const& rel_time){
+        typename condition::backdoor(cond).wait_when_for(*this, pred, rel_time);
+    }
+
+
+private:
+    //friend typename best_condition<Lockable>::type;
+    //friend typename best_condition_any<Lockable>::type;
+    friend class boost::condition_variable;
+    friend class boost::condition_variable_any;
+    friend class boost::interprocess::condition;
+};
+//]
+
+typedef condition_lockable<> thread_condition_mutex;
+typedef condition_lockable<interprocess_mutex> interprocess_condition_mutex;
+
+}
+}
+#endif
Modified: sandbox/synchro/boost/synchro/lockable_adapter.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockable_adapter.hpp	(original)
+++ sandbox/synchro/boost/synchro/lockable_adapter.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -12,6 +12,7 @@
 #define BOOST_SYNCHRO_LOCKABLE_ADAPTER__HPP
 
 #include <boost/synchro/lockable_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/thread/thread_time.hpp>
 
@@ -55,6 +56,13 @@
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return the_lock().try_lock_for(relative_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)
+    {return the_lock().lock_for(relative_time);}
+    
 protected:
     TimedLock& the_lock() {return *static_cast<TimedLock*>(&this->lock_);}
 };
@@ -78,10 +86,13 @@
     {the_lock().unlock_shared();}
     bool try_lock_shared_until(system_time const& t)
     {return the_lock().try_lock_shared_until(t);}
+    void lock_shared_until(system_time const& t)
+    {the_lock().lock_shared_until(t);}
 
 protected:
     SharableLock& the_lock() {return *static_cast<SharableLock*>(&this->lock_);}
 };
+
 //]
 
 //[upgrade_lockable_adapter
@@ -97,11 +108,9 @@
     void lock_upgrade()
     {the_lock().lock_upgrade();}
 
-   bool try_lock_upgrade()
-   {  return the_lock().try_lock_upgrade(); }
+    bool try_lock_upgrade()
+    {  return the_lock().try_lock_upgrade(); }
 
-    
-    
     void unlock_upgrade()
     {the_lock().unlock_upgrade();}
 
@@ -115,6 +124,8 @@
     {the_lock().unlock_upgrade_and_lock_shared();}
     bool try_lock_upgrade_until(system_time const&t)
     {return the_lock().try_lock_upgrade_until(t);}
+    void lock_upgrade_until(system_time const&t)
+    {the_lock().lock_upgrade_until(t);}
 
 protected:
     UpgradableLock& the_lock() {return *static_cast<UpgradableLock*>(&this->lock_);}
@@ -124,7 +135,7 @@
 
 //[lockable_adapter
 template <
-      typename Lockable
+        typename Lockable
       , typename category=typename category_tag<Lockable>::type
       , typename timed_interface=typename timed_interface_tag<Lockable>::type
 > struct lockable_adapter;
Modified: sandbox/synchro/boost/synchro/lockers/strict_locker.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/lockers/strict_locker.hpp	(original)
+++ sandbox/synchro/boost/synchro/lockers/strict_locker.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -72,7 +72,7 @@
     operator bool_type() const;
     bool operator!() const;
     bool owns_lock() const;
-    lockable_type* mutex() const;
+    bool is_locking(lockable_type* l) const; /*< strict locker specific function >*/
 
     BOOST_ADRESS_OF_DELETE(strict_locker)
     BOOST_HEAP_ALLOCATION_DELETE()
Modified: sandbox/synchro/boost/synchro/process/mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/process/mutex.hpp	(original)
+++ sandbox/synchro/boost/synchro/process/mutex.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -15,6 +15,7 @@
 #include <boost/interprocess/sync/interprocess_condition.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/process/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 
@@ -44,6 +45,12 @@
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
+
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
     
     //bool try_lock_shared_until(system_time const& abs_time)
     //{return timed_lock_shared(abs_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-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -14,6 +14,7 @@
 #include <boost/interprocess/sync/named_mutex.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/process/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 class named_mutex
@@ -50,7 +51,12 @@
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
-    
+
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}    
 };    
 #if 0
 typedef boost::interprocess::named_mutex named_mutex;
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-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -14,6 +14,7 @@
 #include <boost/interprocess/sync/named_recursive_mutex.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/process/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 class named_recursive_mutex
@@ -51,7 +52,11 @@
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
    
-
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
 };    
 
 #if 0
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-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -14,6 +14,7 @@
 #include <boost/interprocess/sync/named_upgradable_mutex.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/process/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 
@@ -48,7 +49,13 @@
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
-        
+
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
+    
     void lock_shared()
     {lock_sharable();}
 
@@ -57,6 +64,8 @@
 
     bool try_lock_shared_until(const boost::posix_time::ptime &abs_time)
     {return timed_lock_sharable(abs_time);}
+    void lock_shared_until(const boost::posix_time::ptime &abs_time)
+    {if(!timed_lock_sharable(abs_time)) throw timeout_exception();}
 
     void unlock_shared()
     {unlock_sharable();}
@@ -67,8 +76,10 @@
     bool try_lock_upgrade()
     {return try_lock_upgradable();}
 
-    bool tru_lock_upgrade_until(const boost::posix_time::ptime &abs_time)
+    bool try_lock_upgrade_until(const boost::posix_time::ptime &abs_time)
     {return timed_lock_upgradable(abs_time);}
+    void lock_upgrade_until(const boost::posix_time::ptime &abs_time)
+    {if(!timed_lock_upgradable(abs_time)) throw timeout_exception();}
 
     void unlock_upgrade()
     {unlock_upgradable();}
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-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -14,6 +14,7 @@
 #include <boost/interprocess/sync/interprocess_recursive_mutex.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/process/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 
@@ -45,6 +46,12 @@
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
+
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
     
     //bool try_lock_shared_until(system_time const& abs_time)
     //{return timed_lock_shared(abs_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-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -14,6 +14,7 @@
 #include <boost/interprocess/sync/interprocess_upgradable_mutex.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/process/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 
@@ -44,53 +45,63 @@
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
 
+    void try_lock_until(throw_timeout_t&, system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void try_lock_for(throw_timeout_t&, TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
+    
     void lock_shared()
     {lock_sharable();}
 
-   bool try_lock_shared()
-   {return try_lock_sharable();}
+    bool try_lock_shared()
+    {return try_lock_sharable();}
 
-   bool try_lock_shared_until(const boost::posix_time::ptime &abs_time)
-   {return timed_lock_sharable(abs_time);}
+    bool try_lock_shared_until(const boost::posix_time::ptime &abs_time)
+    {return timed_lock_sharable(abs_time);}
+    void try_lock_shared_until(throw_timeout_t&, const boost::posix_time::ptime &abs_time)
+    {if(!timed_lock_sharable(abs_time)) throw timeout_exception();}
 
-   void unlock_shared()
-   {unlock_sharable();}
+    void unlock_shared()
+    {unlock_sharable();}
 
-   void lock_upgrade()
-   {lock_upgradable();}
+    void lock_upgrade()
+    {lock_upgradable();}
 
-   bool try_lock_upgrade()
-   {return try_lock_upgradable();}
+    bool try_lock_upgrade()
+    {return try_lock_upgradable();}
 
-   bool try_lock_upgrade_until(const boost::posix_time::ptime &abs_time)
-   {return timed_lock_upgradable(abs_time);}
+    bool try_lock_upgrade_until(const boost::posix_time::ptime &abs_time)
+    {return timed_lock_upgradable(abs_time);}
+    void tru_lock_upgrade_until(throw_timeout_t&, const boost::posix_time::ptime &abs_time)
+    {if(!timed_lock_upgradable(abs_time)) throw timeout_exception();}
 
-   void unlock_upgrade()
-   {unlock_upgradable();}
+    void unlock_upgrade()
+    {unlock_upgradable();}
 
-   void unlock_and_lock_upgrade()
-   {unlock_and_lock_upgrade();}
+    void unlock_and_lock_upgrade()
+    {unlock_and_lock_upgrade();}
 
-   void unlock_and_lock_shared()
-   {unlock_and_lock_sharable();}
+    void unlock_and_lock_shared()
+    {unlock_and_lock_sharable();}
 
-   void unlock_upgrade_and_lock_shared()
-   {unlock_upgradable_and_lock_sharable();}
+    void unlock_upgrade_and_lock_shared()
+    {unlock_upgradable_and_lock_sharable();}
 
-   void unlock_upgrade_and_lock()
-   {unlock_upgrade_and_lock();}
+    void unlock_upgrade_and_lock()
+    {unlock_upgrade_and_lock();}
 
-   bool try_unlock_upgrade_and_lock()
-   {return try_unlock_upgradable_and_lock();}
+    bool try_unlock_upgrade_and_lock()
+    {return try_unlock_upgradable_and_lock();}
 
-   bool timed_unlock_upgrade_and_lock(const boost::posix_time::ptime &abs_time)
-   {return timed_unlock_upgradable_and_lock(abs_time);}
+    bool try_unlock_upgrade_and_lock_until(const boost::posix_time::ptime &abs_time)
+    {return timed_unlock_upgradable_and_lock(abs_time);}
 
-   bool try_unlock_share_and_lock()
-   {return try_unlock_sharable_and_lock();}
+    bool try_unlock_share_and_lock()
+    {return try_unlock_sharable_and_lock();}
 
-   bool try_unlock_share_and_lock_upgrade()
-   {return try_unlock_sharable_and_lock_upgradable();}
+    bool try_unlock_share_and_lock_upgrade()
+    {return try_unlock_sharable_and_lock_upgradable();}
 
 };
 
Modified: sandbox/synchro/boost/synchro/thread/mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/thread/mutex.hpp	(original)
+++ sandbox/synchro/boost/synchro/thread/mutex.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -17,6 +17,7 @@
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/thread/thread_time.hpp>
 #include <boost/synchro/thread/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 
 namespace boost { namespace synchro {
@@ -41,11 +42,7 @@
     typedef boost::condition_variable  best_condition_type;
     typedef boost::condition_variable_any  best_condition_any_type;
 
-    thread_mutex() : lock_traits_base<multi_threaded_tag,exclusive_lock_tag,
-                        non_recursive_tag, hasnt_timed_interface_tag, 
-                        process_lifetime_tag,anonymous_tag,
-                        mutex>()
-    {}
+    thread_mutex() {}
 };
 
 template <>
@@ -118,16 +115,24 @@
     thread_timed_mutex &operator=(const thread_mutex &);
 
 public:
-
+    
     typedef boost::condition_variable_any  best_condition_type;
     typedef boost::condition_variable_any  best_condition_any_type;
 
+    thread_timed_mutex () {}
+        
     bool try_lock_until(system_time const & abs_time)
     {return timed_lock(abs_time);}
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
 
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
+    
 };    
 
 #if 0
Modified: sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp	(original)
+++ sandbox/synchro/boost/synchro/thread/recursive_mutex.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -15,6 +15,7 @@
 #include <boost/thread/condition_variable.hpp>
 #include <boost/synchro/thread/lockable_scope_traits.hpp>
 #include <boost/synchro/lockable_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
 
@@ -102,15 +103,8 @@
     thread_recursive_timed_mutex &operator=(const thread_recursive_timed_mutex &);
 
 public:
-    thread_recursive_timed_mutex() : lock_traits_base<
-    multi_threaded_tag,
-    exclusive_lock_tag,
-    recursive_tag,
-    has_timed_interface_tag,
-    process_lifetime_tag,
-    anonymous_tag,
-    recursive_timed_mutex
->(){}
+    thread_recursive_timed_mutex() {}
+        
     typedef boost::condition_variable_any  best_condition_type;
     typedef boost::condition_variable_any  best_condition_any_type;
 
@@ -120,6 +114,12 @@
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
 
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
+    
 };    
 
 #if 0
Modified: sandbox/synchro/boost/synchro/thread/shared_mutex.hpp
==============================================================================
--- sandbox/synchro/boost/synchro/thread/shared_mutex.hpp	(original)
+++ sandbox/synchro/boost/synchro/thread/shared_mutex.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -15,6 +15,7 @@
 #include <boost/thread/condition_variable.hpp>
 #include <boost/synchro/lockable_traits.hpp>
 #include <boost/synchro/thread/lockable_scope_traits.hpp>
+#include <boost/synchro/timeout_exception.hpp>
 
 namespace boost { namespace synchro {
     
@@ -45,10 +46,18 @@
     template<typename TimeDuration>
     bool try_lock_for(TimeDuration const & relative_time)
     {return timed_lock(relative_time);}
+
+    void lock_until(system_time const & abs_time)
+    {if(!timed_lock(abs_time)) throw timeout_exception();}
+    template<typename TimeDuration>
+    void lock_for(TimeDuration const & relative_time)
+    {if(!timed_lock(relative_time)) throw timeout_exception();}
     
     bool try_lock_shared_until(system_time const& abs_time)
     {return timed_lock_shared(abs_time);}
 
+    void lock_shared_until(system_time const& abs_time)
+    {if(!timed_lock_shared(abs_time)) throw timeout_exception();}
     
 };    
 
Added: sandbox/synchro/boost/synchro/timeout_exception.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/synchro/timeout_exception.hpp	2009-02-14 03:53:13 EST (Sat, 14 Feb 2009)
@@ -0,0 +1,31 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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_TIMEOUT_EXCEPTION__HPP
+#define BOOST_SYNCHRO_TIMEOUT_EXCEPTION__HPP
+
+#include <exception>
+#include <stdexcept>
+
+namespace boost { namespace synchro {
+
+    class timeout_exception : public std::logic_error {
+    public:
+        timeout_exception() : std::logic_error("timeout exception") {}
+    };
+
+    struct throw_timeout_t {};
+    struct nothrow_timeout_t {};
+    const throw_timeout_t throw_timeout ={};
+    const nothrow_timeout_t no_throw_timeout ={};
+
+}
+}
+#endif