$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r85770 - in trunk/boost/sync: . detail/darwin detail/event detail/generic detail/mutexes detail/posix detail/semaphore detail/windows locks mutexes
From: andrey.semashev_at_[hidden]
Date: 2013-09-18 04:12:59
Author: andysem
Date: 2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)
New Revision: 85770
URL: http://svn.boost.org/trac/boost/changeset/85770
Log:
Moved files to the new directory structure. Removed unnecessary dependencies. Fixed a few bugs.
Added:
   trunk/boost/sync/detail/event/
   trunk/boost/sync/detail/event/event_emulation.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/generic/event_cv_emulation.hpp
   trunk/boost/sync/detail/event/event_windows.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/windows/event.hpp
   trunk/boost/sync/detail/mutexes/
   trunk/boost/sync/detail/mutexes/mutex_posix.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/posix/mutexes/mutex.hpp
   trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/posix/mutexes/timed_mutex.hpp
   trunk/boost/sync/detail/semaphore/
   trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/darwin/semaphore.hpp
   trunk/boost/sync/detail/semaphore/semaphore_emulation.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/generic/semaphore.hpp
   trunk/boost/sync/detail/semaphore/semaphore_posix.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/posix/semaphore.hpp
   trunk/boost/sync/detail/semaphore/semaphore_windows.hpp
      - copied, changed from r85769, trunk/boost/sync/detail/windows/semaphore.hpp
Deleted:
   trunk/boost/sync/detail/darwin/
   trunk/boost/sync/detail/generic/
   trunk/boost/sync/detail/posix/
   trunk/boost/sync/detail/windows/
Text files modified: 
   trunk/boost/sync/detail/event/event_emulation.hpp         |   100 ++++++++++++++++++--------------------- 
   trunk/boost/sync/detail/event/event_windows.hpp           |     6 +-                                      
   trunk/boost/sync/detail/mutexes/mutex_posix.hpp           |     8 +-                                      
   trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp     |     8 +-                                      
   trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp  |     6 +-                                      
   trunk/boost/sync/detail/semaphore/semaphore_emulation.hpp |    50 +++++++++++--------                     
   trunk/boost/sync/detail/semaphore/semaphore_posix.hpp     |    19 +++++--                                 
   trunk/boost/sync/detail/semaphore/semaphore_windows.hpp   |     6 +-                                      
   trunk/boost/sync/event.hpp                                |     4                                         
   trunk/boost/sync/locks/unique_lock.hpp                    |     9 ++-                                     
   trunk/boost/sync/mutexes/mutex.hpp                        |    11 +++                                     
   trunk/boost/sync/mutexes/timed_mutex.hpp                  |    11 +++                                     
   trunk/boost/sync/semaphore.hpp                            |    14 ++--                                    
   13 files changed, 136 insertions(+), 116 deletions(-)
Copied and modified: trunk/boost/sync/detail/event/event_emulation.hpp (from r85769, trunk/boost/sync/detail/generic/event_cv_emulation.hpp)
==============================================================================
--- trunk/boost/sync/detail/generic/event_cv_emulation.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/event/event_emulation.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -6,13 +6,16 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_SYNC_DETAIL_GENERIC_EVENT_CV_EMULATION_HPP
-#define BOOST_SYNC_DETAIL_GENERIC_EVENT_CV_EMULATION_HPP
+#ifndef BOOST_SYNC_DETAIL_EVENT_EVENT_EMULATION_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_EVENT_EVENT_EMULATION_HPP_INCLUDED_
 
 #include <boost/thread/condition_variable.hpp>
 #include <boost/thread/mutex.hpp>
+#include <boost/thread/locks.hpp>
 
 #include <boost/sync/detail/config.hpp>
+//#include <boost/sync/locks/lock_guard.hpp>
+//#include <boost/sync/locks/unique_lock.hpp>
 #include <boost/sync/detail/header.hpp>
 
 #define BOOST_SYNC_EVENT_EMULATED
@@ -27,45 +30,45 @@
     BOOST_DELETED_FUNCTION(event& operator=(event const&));
 
 public:
-    explicit event(bool auto_reset = false):
-        auto_reset_(auto_reset), set_(false)
-    {}
-
-    ~event()
-    {}
+    explicit event(bool auto_reset = false) :
+        m_auto_reset(auto_reset), m_is_set(false)
+    {
+    }
 
     void post()
     {
-        unique_lock<timed_mutex> lock(mutex_);
-        set_ = true;
-        cv_.notify_all();
+        unique_lock<mutex> lock(m_mutex);
+        m_is_set = true;
+        if (m_auto_reset)
+            m_cond.notify_one();
+        else
+            m_cond.notify_all();
     }
 
     void wait()
     {
-        unique_lock<timed_mutex> lock(mutex_);
-        if (set_) {
-            if (auto_reset_)
-                set_ = false;
-            return;
-        }
+        unique_lock<mutex> lock(m_mutex);
 
-        cv_.wait( lock, bind(&event::is_set, this) );
+        while (!m_is_set)
+            m_cond.wait(lock);
 
-        if (auto_reset_)
-            set_ = false;
+        if (m_auto_reset)
+            m_is_set = false;
     }
 
     void reset()
     {
-        unique_lock<timed_mutex> lock(mutex_);
-        set_ = false;
+        lock_guard<mutex> lock(m_mutex);
+        m_is_set = false;
     }
 
     bool try_wait()
     {
-        unique_lock<timed_mutex> lock(mutex_);
-        return test_status();
+        lock_guard<mutex> lock(m_mutex);
+        const bool res = m_is_set;
+        if (res && m_auto_reset)
+            m_is_set = false;
+        return res;
     }
 
     template <class Rep, class Period>
@@ -77,40 +80,29 @@
     template <class Clock, class Duration>
     bool try_wait_until(const chrono::time_point<Clock, Duration> & timeout)
     {
-        unique_lock<timed_mutex> lock(mutex_, timeout);
-
-        if (!lock.owns_lock())
-            return false;
-
-        const bool success = cv_.wait_until(lock, timeout, bind(&event::is_set, this));
-        if (success)
-            return test_status();
-        else
-            return false;
-    }
+        unique_lock<mutex> lock(m_mutex);
 
-private:
-    inline bool is_set()
-    {
-        return set_;
-    }
+        while (!m_is_set)
+        {
+            if (m_cond.wait_until(lock, timeout) == cv_status::timeout)
+            {
+                if (!m_is_set)
+                    return false;
+                break;
+            }
+        }
 
-    bool test_status()
-    {
-        if (!set_)
-            return false;
-        else {
-            if (auto_reset_)
-                set_ = false;
+        if (m_auto_reset)
+            m_is_set = false;
 
-            return true;
-        }
+        return true;
     }
 
-    timed_mutex mutex_;
-    condition_variable_any cv_;
-    const bool auto_reset_;
-    bool set_;
+private:
+    mutex m_mutex;
+    condition_variable m_cond;
+    const bool m_auto_reset;
+    bool m_is_set;
 };
 
 }
@@ -119,4 +111,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_GENERIC_EVENT_CV_EMULATION_HPP
+#endif // BOOST_SYNC_DETAIL_EVENT_EVENT_EMULATION_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/event/event_windows.hpp (from r85769, trunk/boost/sync/detail/windows/event.hpp)
==============================================================================
--- trunk/boost/sync/detail/windows/event.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/event/event_windows.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -6,8 +6,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_SYNC_EVENT_DETAIL_WINDOWS_EVENT_HPP
-#define BOOST_SYNC_EVENT_DETAIL_WINDOWS_EVENT_HPP
+#ifndef BOOST_SYNC_DETAIL_EVENT_EVENT_WINDOWS_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_EVENT_EVENT_WINDOWS_HPP_INCLUDED_
 
 #include <cstddef>
 #include <boost/assert.hpp>
@@ -144,4 +144,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_EVENT_DETAIL_WINDOWS_EVENT_HPP
+#endif // BOOST_SYNC_DETAIL_EVENT_EVENT_WINDOWS_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/mutexes/mutex_posix.hpp (from r85769, trunk/boost/sync/detail/posix/mutexes/mutex.hpp)
==============================================================================
--- trunk/boost/sync/detail/posix/mutexes/mutex.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/mutexes/mutex_posix.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -8,14 +8,14 @@
  * (C) Copyright 2013 Andrey Semashev
  */
 /*!
- * \file   detail/pthread/mutexes/mutex.hpp
+ * \file   detail/mutexes/mutex_posix.hpp
  *
  * \brief  This header is the Boost.Sync library implementation, see the library documentation
  *         at http://www.boost.org/doc/libs/release/libs/sync/doc/html/index.html.
  */
 
-#ifndef BOOST_SYNC_DETAIL_POSIX_MUTEXES_MUTEX_HPP_INCLUDED_
-#define BOOST_SYNC_DETAIL_POSIX_MUTEXES_MUTEX_HPP_INCLUDED_
+#ifndef BOOST_SYNC_DETAIL_MUTEXES_MUTEX_POSIX_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_MUTEXES_MUTEX_POSIX_HPP_INCLUDED_
 
 #include <cstddef>
 #include <boost/assert.hpp>
@@ -118,4 +118,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_POSIX_MUTEXES_MUTEX_HPP_INCLUDED_
+#endif // BOOST_SYNC_DETAIL_MUTEXES_MUTEX_POSIX_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp (from r85769, trunk/boost/sync/detail/posix/mutexes/timed_mutex.hpp)
==============================================================================
--- trunk/boost/sync/detail/posix/mutexes/timed_mutex.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -8,14 +8,14 @@
  * (C) Copyright 2013 Andrey Semashev
  */
 /*!
- * \file   detail/pthread/mutexes/timed_mutex.hpp
+ * \file   detail/mutexes/timed_mutex_posix.hpp
  *
  * \brief  This header is the Boost.Sync library implementation, see the library documentation
  *         at http://www.boost.org/doc/libs/release/libs/sync/doc/html/index.html.
  */
 
-#ifndef BOOST_SYNC_DETAIL_POSIX_MUTEXES_TIMED_MUTEX_HPP_INCLUDED_
-#define BOOST_SYNC_DETAIL_POSIX_MUTEXES_TIMED_MUTEX_HPP_INCLUDED_
+#ifndef BOOST_SYNC_DETAIL_MUTEXES_TIMED_MUTEX_POSIX_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_MUTEXES_TIMED_MUTEX_POSIX_HPP_INCLUDED_
 
 #include <time.h>
 #include <cstddef>
@@ -253,4 +253,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_POSIX_MUTEXES_TIMED_MUTEX_HPP_INCLUDED_
+#endif // BOOST_SYNC_DETAIL_MUTEXES_TIMED_MUTEX_POSIX_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp (from r85769, trunk/boost/sync/detail/darwin/semaphore.hpp)
==============================================================================
--- trunk/boost/sync/detail/darwin/semaphore.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -6,8 +6,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_SYNC_DETAIL_DARWIN_SEMAPHORE_HPP_INCLUDED_
-#define BOOST_SYNC_DETAIL_DARWIN_SEMAPHORE_HPP_INCLUDED_
+#ifndef BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_DISPATCH_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_DISPATCH_HPP_INCLUDED_
 
 #include <cstddef>
 #include <dispatch/dispatch.h>
@@ -120,4 +120,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_DARWIN_SEMAPHORE_HPP_INCLUDED_
+#endif // BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_DISPATCH_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/semaphore/semaphore_emulation.hpp (from r85769, trunk/boost/sync/detail/generic/semaphore.hpp)
==============================================================================
--- trunk/boost/sync/detail/generic/semaphore.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/semaphore/semaphore_emulation.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -6,15 +6,16 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_SYNC_DETAIL_GENERIC_SEMAPHORE_HPP_INCLUDED_
-#define BOOST_SYNC_DETAIL_GENERIC_SEMAPHORE_HPP_INCLUDED_
-
-#include <boost/bind.hpp>
+#ifndef BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_EMULATION_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_EMULATION_HPP_INCLUDED_
 
+#include <boost/thread/locks.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread/condition_variable.hpp>
 
 #include <boost/sync/detail/config.hpp>
+//#include <boost/sync/locks/lock_guard.hpp>
+//#include <boost/sync/locks/unique_lock.hpp>
 
 #ifdef BOOST_SYNC_USES_CHRONO
 #include <boost/chrono/system_clocks.hpp>
@@ -48,23 +49,24 @@
 
     void post(void)
     {
-        mutex::scoped_lock lock(m_mutex);
+        lock_guard< mutex > lock(m_mutex);
         ++m_count;
         m_cond.notify_one();
     }
 
     void wait(void)
     {
-        mutex::scoped_lock lock(m_mutex);
-        m_cond.wait(lock, boost::bind(&semaphore::check_wakeup_condition, this));
+        unique_lock< mutex > lock(m_mutex);
+        while (m_count == 0)
+            m_cond.wait(lock);
 
         --m_count;
     }
 
     bool try_wait(void)
     {
-        mutex::scoped_lock lock(m_mutex);
-        if (!check_wakeup_condition())
+        lock_guard< mutex > lock(m_mutex);
+        if (m_count == 0)
             return false;
 
         --m_count;
@@ -75,27 +77,31 @@
     template <class Rep, class Period>
     bool try_wait_for(const chrono::duration<Rep, Period> & rel_time)
     {
-        mutex::scoped_lock lock(m_mutex);
-        return m_cond.wait_for(lock, rel_time, boost::bind(&semaphore::check_wakeup_condition, this));
+        return try_wait_until(chrono::steady_clock::now() + rel_time);
     }
 
     template <class Clock, class Duration>
-    bool try_wait_until(const chrono::time_point<Clock, Duration> & timeout )
+    bool try_wait_until(const chrono::time_point<Clock, Duration> & timeout)
     {
-        mutex::scoped_lock lock(m_mutex);
-        return m_cond.wait_until(lock, timeout, boost::bind(&semaphore::check_wakeup_condition, this));
+        unique_lock< mutex > lock(m_mutex);
+        while (m_count == 0)
+        {
+            if (m_cond.wait_until(lock, timeout) == cv_status::timeout)
+            {
+                if (m_count == 0)
+                    return false;
+                break;
+            }
+        }
+        --m_count;
+        return true;
     }
 #endif // BOOST_SYNC_USES_CHRONO
 
 private:
-    bool check_wakeup_condition()
-    {
-        return m_count > 0;
-    }
-
+    mutex m_mutex;
+    condition_variable m_cond;
     unsigned int m_count;
-    boost::mutex m_mutex;
-    boost::condition_variable m_cond;
 };
 
 } // namespace
@@ -106,4 +112,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_GENERIC_SEMAPHORE_HPP_INCLUDED_
+#endif // BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_EMULATION_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/semaphore/semaphore_posix.hpp (from r85769, trunk/boost/sync/detail/posix/semaphore.hpp)
==============================================================================
--- trunk/boost/sync/detail/posix/semaphore.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/semaphore/semaphore_posix.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -7,9 +7,10 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 
-#ifndef BOOST_SYNC_DETAIL_POSIX_SEMAPHORE_HPP_INCLUDED_
-#define BOOST_SYNC_DETAIL_POSIX_SEMAPHORE_HPP_INCLUDED_
+#ifndef BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_POSIX_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_POSIX_HPP_INCLUDED_
 
+#include <errno.h>
 #include <semaphore.h>
 
 #include <boost/assert.hpp>
@@ -44,7 +45,10 @@
     {
         const int status = sem_init(&m_sem, 0, i);
         if (status)
-            BOOST_THROW_EXCEPTION(resource_error(status, "boost::sync::semaphore constructor failed in sem_init"));
+        {
+            const int err = errno;
+            BOOST_THROW_EXCEPTION(resource_error(err, "boost::sync::semaphore constructor failed in sem_init"));
+        }
     }
 
     ~semaphore()
@@ -55,11 +59,14 @@
     void post()
     {
         const int status = sem_post(&m_sem);
+        if (status == 0)
+            return;
 
-        switch (status)
+        const int err = errno;
+        switch (err)
         {
         case EOVERFLOW:
-            BOOST_THROW_EXCEPTION(resource_error(status, "boost::sync::semaphore post failed: Maximum allowable value would be exceeded"));
+            BOOST_THROW_EXCEPTION(resource_error(err, "boost::sync::semaphore post failed: maximum allowable value would be exceeded"));
             break;
 
         case EINVAL:
@@ -182,4 +189,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_POSIX_SEMAPHORE_HPP_INCLUDED_
+#endif // BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_POSIX_HPP_INCLUDED_
Copied and modified: trunk/boost/sync/detail/semaphore/semaphore_windows.hpp (from r85769, trunk/boost/sync/detail/windows/semaphore.hpp)
==============================================================================
--- trunk/boost/sync/detail/windows/semaphore.hpp	Tue Sep 17 21:32:03 2013	(r85769, copy source)
+++ trunk/boost/sync/detail/semaphore/semaphore_windows.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -6,8 +6,8 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef BOOST_SYNC_DETAIL_WINDOWS_SEMAPHORE_HPP_INCLUDED_
-#define BOOST_SYNC_DETAIL_WINDOWS_SEMAPHORE_HPP_INCLUDED_
+#ifndef BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_WINDOWS_HPP_INCLUDED_
+#define BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_WINDOWS_HPP_INCLUDED_
 
 #include <cstddef>
 #include <limits>
@@ -142,4 +142,4 @@
 
 #include <boost/sync/detail/footer.hpp>
 
-#endif // BOOST_SYNC_DETAIL_WINDOWS_SEMAPHORE_HPP_INCLUDED_
+#endif // BOOST_SYNC_DETAIL_SEMAPHORE_SEMAPHORE_WINDOWS_HPP_INCLUDED_
Modified: trunk/boost/sync/event.hpp
==============================================================================
--- trunk/boost/sync/event.hpp	Tue Sep 17 21:32:03 2013	(r85769)
+++ trunk/boost/sync/event.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -98,7 +98,7 @@
 #endif
 
 #if defined(BOOST_SYNC_DETAIL_PLATFORM_WINAPI)
-#include <boost/sync/detail/windows/event.hpp>
+#include <boost/sync/detail/event_windows.hpp>
 
 //#elif defined(BOOST_SYNC_POSIX_SEMAPHORES)
 //#include <boost/sync/semaphore/semaphore_posix.hpp>
@@ -108,7 +108,7 @@
 
 #else
 
-#include <boost/sync/detail/generic/event_cv_emulation.hpp>
+#include <boost/sync/detail/event/event_emulation.hpp>
 
 #endif
 
Modified: trunk/boost/sync/locks/unique_lock.hpp
==============================================================================
--- trunk/boost/sync/locks/unique_lock.hpp	Tue Sep 17 21:32:03 2013	(r85769)
+++ trunk/boost/sync/locks/unique_lock.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -61,6 +61,7 @@
 public:
     BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_lock)
 
+public:
     unique_lock() BOOST_NOEXCEPT :
         m_mutex(NULL), m_is_locked(false)
     {
@@ -99,8 +100,8 @@
         that.m_is_locked = false;
     }
 
-    explicit unique_lock(BOOST_RV_REF(upgrade_lock< mutex_type >) that)
-        m_mutex(that.m_mutex), is_locked(that.m_is_locked)
+    explicit unique_lock(BOOST_RV_REF(upgrade_lock< mutex_type >) that) :
+        m_mutex(that.m_mutex), m_is_locked(that.m_is_locked)
     {
         if (m_is_locked)
         {
@@ -227,7 +228,7 @@
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
         }
 
-        m_is_locked = m->timed_lock(time);
+        m_is_locked = m_mutex->timed_lock(time);
 
         return m_is_locked;
     }
@@ -250,7 +251,7 @@
     }
 
     template< typename TimePoint >
-    typename detail::enable_if_tag< Duration, detail::time_point_tag, bool >::type try_lock_until(TimePoint const& abs_time)
+    typename detail::enable_if_tag< TimePoint, detail::time_point_tag, bool >::type try_lock_until(TimePoint const& abs_time)
     {
         if (!m_mutex)
         {
Modified: trunk/boost/sync/mutexes/mutex.hpp
==============================================================================
--- trunk/boost/sync/mutexes/mutex.hpp	Tue Sep 17 21:32:03 2013	(r85769)
+++ trunk/boost/sync/mutexes/mutex.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -24,6 +24,13 @@
 {
 public:
     /*!
+     * \brief A platform-specific type of the low level mutex implementation.
+     * \note This type is only available if \c BOOST_SYNC_DEFINES_MUTEX_NATIVE_HANDLE macro is defined by the library.
+     */
+    typedef unspecified native_handle_type;
+
+public:
+    /*!
      * \brief Default constructor
      *
      * Creates a mutual exclusion primitive in the unlocked state.
@@ -92,9 +99,9 @@
 #endif
 
 #if defined(BOOST_SYNC_DETAIL_PLATFORM_PTHREAD)
-#include <boost/sync/detail/posix/mutexes/mutex.hpp>
+#include <boost/sync/detail/mutexes/mutex_posix.hpp>
 #elif defined(BOOST_SYNC_DETAIL_PLATFORM_WINAPI)
-#include <boost/sync/detail/windows/mutexes/mutex.hpp>
+#include <boost/sync/detail/mutexes/mutex_windows.hpp>
 #else
 #error Boost.Sync: Unsupported threading API
 #endif
Modified: trunk/boost/sync/mutexes/timed_mutex.hpp
==============================================================================
--- trunk/boost/sync/mutexes/timed_mutex.hpp	Tue Sep 17 21:32:03 2013	(r85769)
+++ trunk/boost/sync/mutexes/timed_mutex.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -24,6 +24,13 @@
 {
 public:
     /*!
+     * \brief A platform-specific type of the low level mutex implementation.
+     * \note This type is only available if \c BOOST_SYNC_DEFINES_TIMED_MUTEX_NATIVE_HANDLE macro is defined by the library.
+     */
+    typedef unspecified native_handle_type;
+
+public:
+    /*!
      * \brief Default constructor
      *
      * Creates a mutual exclusion primitive in the unlocked state.
@@ -106,9 +113,9 @@
 #endif
 
 #if defined(BOOST_SYNC_DETAIL_PLATFORM_PTHREAD)
-#include <boost/sync/detail/posix/mutexes/timed_mutex.hpp>
+#include <boost/sync/detail/mutexes/timed_mutex_posix.hpp>
 #elif defined(BOOST_SYNC_DETAIL_PLATFORM_WINAPI)
-#include <boost/sync/detail/windows/mutexes/timed_mutex.hpp>
+#include <boost/sync/detail/mutexes/timed_mutex_windows.hpp>
 #else
 #error Boost.Sync: Unsupported threading API
 #endif
Modified: trunk/boost/sync/semaphore.hpp
==============================================================================
--- trunk/boost/sync/semaphore.hpp	Tue Sep 17 21:32:03 2013	(r85769)
+++ trunk/boost/sync/semaphore.hpp	2013-09-18 04:12:59 EDT (Wed, 18 Sep 2013)	(r85770)
@@ -94,7 +94,7 @@
 
 #endif // BOOST_HAS_UNISTD_H
 
-#if !defined(BOOST_SYNC_DETAIL_USE_POSIX_SEMAPHORES) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
+#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
 #include <Availability.h>
 
 // OSX
@@ -120,16 +120,16 @@
 
 
 #if defined(BOOST_SYNC_DETAIL_PLATFORM_WINAPI)
-#include <boost/sync/detail/windows/semaphore.hpp>
-
-#elif defined(BOOST_SYNC_DETAIL_USE_POSIX_SEMAPHORES)
-#include <boost/sync/detail/posix/semaphore.hpp>
+#include <boost/sync/detail/semaphore/semaphore_windows.hpp>
 
 #elif defined(BOOST_SYNC_DETAIL_USE_DISPATCH_SEMAPHORES)
-#include <boost/sync/detail/darwin/semaphore.hpp>
+#include <boost/sync/detail/semaphore/semaphore_dispatch.hpp>
+
+#elif defined(BOOST_SYNC_DETAIL_USE_POSIX_SEMAPHORES)
+#include <boost/sync/detail/semaphore/semaphore_posix.hpp>
 
 #else
-#include <boost/sync/detail/generic/semaphore.hpp>
+#include <boost/sync/detail/semaphore/semaphore_emulation.hpp>
 
 #endif