$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r76168 - in trunk/boost/interprocess: . detail sync sync/posix sync/shm sync/spin sync/windows
From: igaztanaga_at_[hidden]
Date: 2011-12-26 06:08:46
Author: igaztanaga
Date: 2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
New Revision: 76168
URL: http://svn.boost.org/trac/boost/changeset/76168
Log:
Updated timed functions to fulfill posix requirements.
Text files modified: 
   trunk/boost/interprocess/detail/os_file_functions.hpp        |    11 ++-                                     
   trunk/boost/interprocess/shared_memory_object.hpp            |     4                                         
   trunk/boost/interprocess/sync/named_mutex.hpp                |     7 ++                                      
   trunk/boost/interprocess/sync/posix/mutex.hpp                |     2                                         
   trunk/boost/interprocess/sync/posix/recursive_mutex.hpp      |     2                                         
   trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp    |     4                                         
   trunk/boost/interprocess/sync/shm/named_condition.hpp        |   114 ++++++++++++++++++++++++++------------- 
   trunk/boost/interprocess/sync/shm/named_mutex.hpp            |     6 +-                                      
   trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp |     6 +-                                      
   trunk/boost/interprocess/sync/spin/condition.hpp             |    32 +++++-----                              
   trunk/boost/interprocess/sync/spin/mutex.hpp                 |     2                                         
   trunk/boost/interprocess/sync/spin/recursive_mutex.hpp       |     3                                         
   trunk/boost/interprocess/sync/spin/semaphore.hpp             |     2                                         
   trunk/boost/interprocess/sync/windows/mutex.hpp              |    25 +++-----                                
   trunk/boost/interprocess/sync/windows/semaphore.hpp          |    25 +++-----                                
   15 files changed, 136 insertions(+), 109 deletions(-)
Modified: trunk/boost/interprocess/detail/os_file_functions.hpp
==============================================================================
--- trunk/boost/interprocess/detail/os_file_functions.hpp	(original)
+++ trunk/boost/interprocess/detail/os_file_functions.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -18,6 +18,7 @@
 
 #include <string>
 #include <limits>
+#include <climits>
 
 #if (defined BOOST_INTERPROCESS_WINDOWS)
 #  include <boost/interprocess/detail/win32_api.hpp>
@@ -448,11 +449,13 @@
 
 inline bool truncate_file (file_handle_t hnd, std::size_t size)
 {
-   if(off_t(size) < 0){
-      errno = EINVAL;
-      return false;
+   if(sizeof(off_t) == sizeof(std::size_t)){
+      if(size > ((~std::size_t(0)) >> 1)){
+         errno = EINVAL;
+         return false;
+      }
    }
-   return 0 == ::ftruncate(hnd, size);
+   return 0 == ::ftruncate(hnd, off_t(size));
 }
 
 inline bool get_file_size(file_handle_t hnd, offset_t &size)
Modified: trunk/boost/interprocess/shared_memory_object.hpp
==============================================================================
--- trunk/boost/interprocess/shared_memory_object.hpp	(original)
+++ trunk/boost/interprocess/shared_memory_object.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -275,7 +275,7 @@
    #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
    const bool add_leading_slash = false;
    #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
-   const bool add_leading_slash = !shared_memory_object_ipcdetail::use_filesystem_based_posix();
+   const bool add_leading_slash = !shared_memory_object_detail::use_filesystem_based_posix();
    #else
    const bool add_leading_slash = true;
    #endif
@@ -361,7 +361,7 @@
       #if defined(BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
       const bool add_leading_slash = false;
       #elif defined(BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY)
-      const bool add_leading_slash = !shared_memory_object_ipcdetail::use_filesystem_based_posix();
+      const bool add_leading_slash = !shared_memory_object_detail::use_filesystem_based_posix();
       #else
       const bool add_leading_slash = true;
       #endif
Modified: trunk/boost/interprocess/sync/named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/named_mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -106,10 +106,15 @@
 
    #if defined(BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
    typedef ipcdetail::posix_named_mutex   impl_t;
+   impl_t m_mut;
    #else
    typedef ipcdetail::shm_named_mutex     impl_t;
-   #endif
    impl_t m_mut;
+   public:
+   interprocess_mutex *mutex() const
+   {  return m_mut.mutex(); }
+   #endif
+
    /// @endcond
 };
 
Modified: trunk/boost/interprocess/sync/posix/mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/posix/mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -119,8 +119,6 @@
    //Obtain current count and target time
    boost::posix_time::ptime now = microsec_clock::universal_time();
 
-   if(now >= abs_time) return false;
-
    do{
       if(this->try_lock()){
          break;
Modified: trunk/boost/interprocess/sync/posix/recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/recursive_mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/posix/recursive_mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -109,8 +109,6 @@
    //Obtain current count and target time
    boost::posix_time::ptime now = microsec_clock::universal_time();
 
-   if(now >= abs_time) return false;
-
    do{
       if(this->try_lock()){
          break;
Modified: trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp	(original)
+++ trunk/boost/interprocess/sync/posix/semaphore_wrapper.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -195,11 +195,11 @@
    return false;
    #else //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
    boost::posix_time::ptime now;
-   while((now = microsec_clock::universal_time()) < abs_time){
+   do{
       if(semaphore_try_wait(handle))
          return true;
       thread_yield();
-   }
+   }while((now = microsec_clock::universal_time()) < abs_time);
    return false;
    #endif   //#ifdef BOOST_INTERPROCESS_POSIX_TIMEOUTS
 }
Modified: trunk/boost/interprocess/sync/shm/named_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_condition.hpp	(original)
+++ trunk/boost/interprocess/sync/shm/named_condition.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -148,42 +148,68 @@
    };
 
    #if defined (BOOST_INTERPROCESS_NAMED_MUTEX_USES_POSIX_SEMAPHORES)
-   interprocess_mutex *mutex() const
-   {  return &static_cast<condition_holder*>(m_shmem.get_user_address())->mutex_; }
+      interprocess_mutex *mutex() const
+      {  return &static_cast<condition_holder*>(m_shmem.get_user_address())->mutex_; }
 
-   template <class Lock>
-   void do_wait(Lock& lock)
-   {
-      //shm_named_condition only works with named_mutex
-      BOOST_STATIC_ASSERT((is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
-      
-      //lock internal before unlocking external to avoid race with a notifier
-      scoped_lock<interprocess_mutex>     internal_lock(*this->mutex());
-      lock_inverter<Lock> inverted_lock(lock);
-      scoped_lock<lock_inverter<Lock> >   external_unlock(inverted_lock);
-
-      //unlock internal first to avoid deadlock with near simultaneous waits
-      scoped_lock<interprocess_mutex>     internal_unlock;
-      internal_lock.swap(internal_unlock);
-      this->condition()->wait(internal_unlock);
-   }
+      template <class Lock>
+      void do_wait(Lock& lock)
+      {
+         //shm_named_condition only works with named_mutex
+         BOOST_STATIC_ASSERT((is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
+         
+         //lock internal before unlocking external to avoid race with a notifier
+         scoped_lock<interprocess_mutex>     internal_lock(*this->mutex());
+         lock_inverter<Lock> inverted_lock(lock);
+         scoped_lock<lock_inverter<Lock> >   external_unlock(inverted_lock);
+
+         //unlock internal first to avoid deadlock with near simultaneous waits
+         scoped_lock<interprocess_mutex>     internal_unlock;
+         internal_lock.swap(internal_unlock);
+         this->condition()->wait(internal_unlock);
+      }
 
-   template <class Lock>
-   bool do_timed_wait(Lock& lock, const boost::posix_time::ptime &abs_time)
-   {
-      //shm_named_condition only works with named_mutex
-      BOOST_STATIC_ASSERT((is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
-      //lock internal before unlocking external to avoid race with a notifier  
-      scoped_lock<interprocess_mutex>     internal_lock(*this->mutex(), abs_time);  
-      if(!internal_lock) return false;
-      lock_inverter<Lock> inverted_lock(lock);  
-      scoped_lock<lock_inverter<Lock> >   external_unlock(inverted_lock);  
-
-      //unlock internal first to avoid deadlock with near simultaneous waits  
-      scoped_lock<interprocess_mutex>     internal_unlock;  
-      internal_lock.swap(internal_unlock);  
-      return this->condition()->timed_wait(internal_unlock, abs_time);  
-   }
+      template <class Lock>
+      bool do_timed_wait(Lock& lock, const boost::posix_time::ptime &abs_time)
+      {
+         //shm_named_condition only works with named_mutex
+         BOOST_STATIC_ASSERT((is_convertible<typename Lock::mutex_type&, named_mutex&>::value == true));
+         //lock internal before unlocking external to avoid race with a notifier  
+         scoped_lock<interprocess_mutex>     internal_lock(*this->mutex(), abs_time);  
+         if(!internal_lock) return false;
+         lock_inverter<Lock> inverted_lock(lock);  
+         scoped_lock<lock_inverter<Lock> >   external_unlock(inverted_lock);  
+
+         //unlock internal first to avoid deadlock with near simultaneous waits  
+         scoped_lock<interprocess_mutex>     internal_unlock;  
+         internal_lock.swap(internal_unlock);  
+         return this->condition()->timed_wait(internal_unlock, abs_time);  
+      }
+   #else
+      template<class Lock>
+      class lock_wrapper
+      {
+         typedef void (lock_wrapper::*unspecified_bool_type)();
+         public:
+
+         typedef interprocess_mutex mutex_type;
+
+         lock_wrapper(Lock &l)
+            : l_(l)
+         {}
+
+         mutex_type* mutex() const
+         {  return l_.mutex()->mutex();  }
+
+         void lock()    { l_.lock(); }
+
+         void unlock()  { l_.unlock(); }
+
+         operator unspecified_bool_type() const
+         {  return l_ ? &lock_wrapper::lock : 0;  }
+
+         private:
+         Lock &l_;
+      };
    #endif
 
    friend class boost::interprocess::ipcdetail::interprocess_tester;
@@ -309,21 +335,33 @@
 
 template <typename L>
 inline void shm_named_condition::wait(L& lock)
-{  this->condition()->wait(lock);  }
+{
+   lock_wrapper<L> newlock(lock);
+   this->condition()->wait(newlock);
+}
 
 template <typename L, typename Pr>
 inline void shm_named_condition::wait(L& lock, Pr pred)
-{  this->condition()->wait(lock, pred);  }
+{
+   lock_wrapper<L> newlock(lock);
+   this->condition()->wait(newlock, pred);
+}
 
 template <typename L>
 inline bool shm_named_condition::timed_wait
    (L& lock, const boost::posix_time::ptime &abs_time)
-{  return this->condition()->timed_wait(lock, abs_time);  }
+{
+   lock_wrapper<L> newlock(lock);
+   return this->condition()->timed_wait(newlock, abs_time);
+}
 
 template <typename L, typename Pr>
 inline bool shm_named_condition::timed_wait
    (L& lock, const boost::posix_time::ptime &abs_time, Pr pred)
-{  return this->condition()->timed_wait(lock, abs_time, pred);  }
+{
+   lock_wrapper<L> newlock(lock);
+   return this->condition()->timed_wait(newlock, abs_time, pred);
+}
 
 #endif
 
Modified: trunk/boost/interprocess/sync/shm/named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/shm/named_mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -100,13 +100,13 @@
    static bool remove(const char *name);
 
    /// @cond
+   interprocess_mutex *mutex() const
+   {  return static_cast<interprocess_mutex*>(m_shmem.get_user_address()); }
+
    private:
    friend class ipcdetail::interprocess_tester;
    void dont_close_on_destruction();
 
-   interprocess_mutex *mutex() const
-   {  return static_cast<interprocess_mutex*>(m_shmem.get_user_address()); }
-
    ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
    typedef ipcdetail::named_creation_functor<interprocess_mutex> construct_func_t;
    /// @endcond
Modified: trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -8,8 +8,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_INTERPROCESS_named_upgradable_mutex_HPP
-#define BOOST_INTERPROCESS_named_upgradable_mutex_HPP
+#ifndef BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_HPP
+#define BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_HPP
 
 #if (defined _MSC_VER) && (_MSC_VER >= 1200)
 #  pragma once
@@ -369,4 +369,4 @@
 
 #include <boost/interprocess/detail/config_end.hpp>
 
-#endif   //BOOST_INTERPROCESS_named_upgradable_mutex_HPP
+#endif   //BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_HPP
Modified: trunk/boost/interprocess/sync/spin/condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/spin/condition.hpp	(original)
+++ trunk/boost/interprocess/sync/spin/condition.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -13,9 +13,9 @@
 
 #include <boost/interprocess/detail/config_begin.hpp>
 #include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/sync/spin/mutex.hpp>
 #include <boost/interprocess/detail/posix_time_types_wrk.hpp>
 #include <boost/interprocess/detail/atomic.hpp>
-#include <boost/interprocess/sync/spin/mutex.hpp>
 #include <boost/interprocess/sync/scoped_lock.hpp>
 #include <boost/interprocess/exceptions.hpp>
 #include <boost/interprocess/detail/os_thread_functions.hpp>
@@ -94,7 +94,7 @@
    bool do_timed_wait(bool tout_enabled, const boost::posix_time::ptime &abs_time, InterprocessMutex &mut);
 
    enum { SLEEP = 0, NOTIFY_ONE, NOTIFY_ALL };
-   ipcdetail::spin_mutex  m_enter_mut;
+   spin_mutex  m_enter_mut;
    volatile boost::uint32_t    m_command;
    volatile boost::uint32_t    m_num_waiters;
    void notify(boost::uint32_t command);
@@ -134,19 +134,19 @@
    m_enter_mut.lock();
 
    //Return if there are no waiters
-   if(!ipcdetail::atomic_read32(&m_num_waiters)) { 
+   if(!atomic_read32(&m_num_waiters)) { 
       m_enter_mut.unlock();
       return;
    }
 
    //Notify that all threads should execute wait logic
-   while(SLEEP != ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_command), command, SLEEP)){
-      ipcdetail::thread_yield();
+   while(SLEEP != atomic_cas32(const_cast<boost::uint32_t*>(&m_command), command, SLEEP)){
+      thread_yield();
    }
 /*
    //Wait until the threads are woken
-   while(SLEEP != ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_command), 0)){
-      ipcdetail::thread_yield();
+   while(SLEEP != atomic_cas32(const_cast<boost::uint32_t*>(&m_command), 0)){
+      thread_yield();
    }
 */
    //The enter mutex will rest locked until the last waiting thread unlocks it
@@ -176,7 +176,7 @@
       if(now >= abs_time) return false;
    }
 
-   typedef boost::interprocess::scoped_lock<ipcdetail::spin_mutex> InternalLock;
+   typedef boost::interprocess::scoped_lock<spin_mutex> InternalLock;
    //The enter mutex guarantees that while executing a notification, 
    //no other thread can execute the do_timed_wait method. 
    {
@@ -197,7 +197,7 @@
       //We increment the waiting thread count protected so that it will be
       //always constant when another thread enters the notification logic.
       //The increment marks this thread as "waiting on spin_condition"
-      ipcdetail::atomic_inc32(const_cast<boost::uint32_t*>(&m_num_waiters));
+      atomic_inc32(const_cast<boost::uint32_t*>(&m_num_waiters));
 
       //We unlock the external mutex atomically with the increment
       mut.unlock();
@@ -211,8 +211,8 @@
    while(1){
       //The thread sleeps/spins until a spin_condition commands a notification
       //Notification occurred, we will lock the checking mutex so that
-      while(ipcdetail::atomic_read32(&m_command) == SLEEP){
-         ipcdetail::thread_yield();
+      while(atomic_read32(&m_command) == SLEEP){
+         thread_yield();
 
          //Check for timeout
          if(tout_enabled){
@@ -240,12 +240,12 @@
       //If a timeout occurred, the mutex will not execute checking logic
       if(tout_enabled && timed_out){
          //Decrement wait count
-         ipcdetail::atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
+         atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
          unlock_enter_mut = true;
          break;
       }
       else{
-         boost::uint32_t result = ipcdetail::atomic_cas32
+         boost::uint32_t result = atomic_cas32
                         (const_cast<boost::uint32_t*>(&m_command), SLEEP, NOTIFY_ONE);
          if(result == SLEEP){
             //Other thread has been notified and since it was a NOTIFY one
@@ -258,17 +258,17 @@
             //so no other thread will exit.
             //Decrement wait count.
             unlock_enter_mut = true;
-            ipcdetail::atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
+            atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
             break;
          }
          else{
             //If it is a NOTIFY_ALL command, all threads should return 
             //from do_timed_wait function. Decrement wait count. 
-            unlock_enter_mut = 1 == ipcdetail::atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
+            unlock_enter_mut = 1 == atomic_dec32(const_cast<boost::uint32_t*>(&m_num_waiters));
             //Check if this is the last thread of notify_all waiters
             //Only the last thread will release the mutex
             if(unlock_enter_mut){
-               ipcdetail::atomic_cas32(const_cast<boost::uint32_t*>(&m_command), SLEEP, NOTIFY_ALL);
+               atomic_cas32(const_cast<boost::uint32_t*>(&m_command), SLEEP, NOTIFY_ALL);
             }
             break;
          }
Modified: trunk/boost/interprocess/sync/spin/mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/spin/mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/spin/mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -86,8 +86,6 @@
    //Obtain current count and target time
    boost::posix_time::ptime now = microsec_clock::universal_time();
 
-   if(now >= abs_time) return false;
-
    do{
       if(this->try_lock()){
          break;
Modified: trunk/boost/interprocess/sync/spin/recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/spin/recursive_mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/spin/recursive_mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -163,8 +163,7 @@
    typedef ipcdetail::OS_systemwide_thread_id_t handle_t;
    this->m_nLockCount = 1;
    const handle_t thr_id(ipcdetail::get_current_systemwide_thread_id());
-   ipcdetail::systemwide_thread_id_copy
-      (thr_id, m_nOwner);
+   ipcdetail::systemwide_thread_id_copy(thr_id, m_nOwner);
 }
 
 }  //namespace ipcdetail {
Modified: trunk/boost/interprocess/sync/spin/semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/spin/semaphore.hpp	(original)
+++ trunk/boost/interprocess/sync/spin/semaphore.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -79,8 +79,6 @@
    }
    //Obtain current count and target time
    boost::posix_time::ptime now(microsec_clock::universal_time());
-   if(now >= abs_time)
-      return false;
 
    do{
       if(this->try_wait()){
Modified: trunk/boost/interprocess/sync/windows/mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/windows/mutex.hpp	(original)
+++ trunk/boost/interprocess/sync/windows/mutex.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -104,22 +104,17 @@
    boost::posix_time::ptime now
       = boost::posix_time::microsec_clock::universal_time();
 
-   if(abs_time < now){
-      return false;
-   }
-   else{
-      unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds();
-      sync_handles &handles =
-         intermodule_singleton<sync_handles>::get();
-      //This can throw
-      void *hnd = handles.obtain_mutex(this->id_);
-      unsigned long ret = winapi::wait_for_single_object(hnd, ms);
-      if(ret == winapi::wait_failed){
-         error_info err(winapi::get_last_error());
-         throw interprocess_exception(err);
-      }
-      return ret != winapi::wait_timeout;
+   unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds();
+   sync_handles &handles =
+      intermodule_singleton<sync_handles>::get();
+   //This can throw
+   void *hnd = handles.obtain_mutex(this->id_);
+   unsigned long ret = winapi::wait_for_single_object(hnd, ms);
+   if(ret == winapi::wait_failed){
+      error_info err(winapi::get_last_error());
+      throw interprocess_exception(err);
    }
+   return ret != winapi::wait_timeout;
 }
 
 inline void windows_mutex::unlock(void)
Modified: trunk/boost/interprocess/sync/windows/semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/windows/semaphore.hpp	(original)
+++ trunk/boost/interprocess/sync/windows/semaphore.hpp	2011-12-26 06:08:44 EST (Mon, 26 Dec 2011)
@@ -103,22 +103,17 @@
    boost::posix_time::ptime now
       = boost::posix_time::microsec_clock::universal_time();
 
-   if(abs_time < now){
-      return false;
-   }
-   else{
-      unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds();
-      sync_handles &handles =
-         intermodule_singleton<sync_handles>::get();
-      //This can throw
-      void *hnd = handles.obtain_semaphore(this->id_, 0);
-      unsigned long ret = winapi::wait_for_single_object(hnd, ms);
-      if(ret == winapi::wait_failed){
-         error_info err(winapi::get_last_error());
-         throw interprocess_exception(err);
-      }
-      return ret != winapi::wait_timeout;
+   unsigned long ms = (unsigned long)(abs_time-now).total_milliseconds();
+   sync_handles &handles =
+      intermodule_singleton<sync_handles>::get();
+   //This can throw
+   void *hnd = handles.obtain_semaphore(this->id_, 0);
+   unsigned long ret = winapi::wait_for_single_object(hnd, ms);
+   if(ret == winapi::wait_failed){
+      error_info err(winapi::get_last_error());
+      throw interprocess_exception(err);
    }
+   return ret != winapi::wait_timeout;
 }
 
 inline void windows_semaphore::post(long release_count)