diff options
Diffstat (limited to '3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp')
| -rw-r--r-- | 3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp | 37 | 
1 files changed, 32 insertions, 5 deletions
| diff --git a/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp b/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp index fef2d5b..252174f 100644 --- a/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp @@ -95,7 +95,7 @@ namespace boost                detail::win32::release_semaphore(semaphores[exclusive_sem],LONG_MAX);                boost::throw_exception(thread_resource_error());              } -            state_data state_={0}; +            state_data state_={0,0,0,0,0,0};              state=state_;          } @@ -133,15 +133,19 @@ namespace boost          void lock_shared()          { +#if defined BOOST_THREAD_USES_DATETIME              BOOST_VERIFY(timed_lock_shared(::boost::detail::get_system_time_sentinel())); +#else +            BOOST_VERIFY(try_lock_shared_until(chrono::steady_clock::now())); +#endif          } +#if defined BOOST_THREAD_USES_DATETIME          template<typename TimeDuration>          bool timed_lock_shared(TimeDuration const & relative_time)          {              return timed_lock_shared(get_system_time()+relative_time);          } -          bool timed_lock_shared(boost::system_time const& wait_until)          {              for(;;) @@ -220,6 +224,7 @@ namespace boost                  BOOST_ASSERT(res==0);              }          } +#endif  #ifdef BOOST_THREAD_USES_CHRONO          template <class Rep, class Period> @@ -378,14 +383,20 @@ namespace boost          void lock()          { +#if defined BOOST_THREAD_USES_DATETIME              BOOST_VERIFY(timed_lock(::boost::detail::get_system_time_sentinel())); +#else +            BOOST_VERIFY(try_lock_until(chrono::steady_clock::now())); +#endif          } +#if defined BOOST_THREAD_USES_DATETIME          template<typename TimeDuration>          bool timed_lock(TimeDuration const & relative_time)          {              return timed_lock(get_system_time()+relative_time);          } +#endif          bool try_lock()          { @@ -413,6 +424,7 @@ namespace boost          } +#if defined BOOST_THREAD_USES_DATETIME          bool timed_lock(boost::system_time const& wait_until)          {              for(;;) @@ -459,6 +471,7 @@ namespace boost                  {                      for(;;)                      { +                        bool must_notify = false;                          state_data new_state=old_state;                          if(new_state.shared_count || new_state.exclusive)                          { @@ -467,6 +480,7 @@ namespace boost                                  if(!--new_state.exclusive_waiting)                                  {                                      new_state.exclusive_waiting_blocked=false; +                                    must_notify = true;                                  }                              }                          } @@ -476,6 +490,11 @@ namespace boost                          }                          state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); +                        if (must_notify) +                        { +                          BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[unlock_sem],1,0)!=0); +                        } +                          if(current_state==old_state)                          {                              break; @@ -491,7 +510,7 @@ namespace boost                  BOOST_ASSERT(wait_res<2);              }          } - +#endif  #ifdef BOOST_THREAD_USES_CHRONO          template <class Rep, class Period>          bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) @@ -568,6 +587,7 @@ namespace boost              {                for(;;)                { +                bool must_notify = false;                  state_data new_state=old_state;                  if(new_state.shared_count || new_state.exclusive)                  { @@ -576,6 +596,7 @@ namespace boost                      if(!--new_state.exclusive_waiting)                      {                        new_state.exclusive_waiting_blocked=false; +                      must_notify = true;                      }                    }                  } @@ -585,6 +606,10 @@ namespace boost                  }                  state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); +                if (must_notify) +                { +                  BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[unlock_sem],1,0)!=0); +                }                  if(current_state==old_state)                  {                    break; @@ -724,9 +749,11 @@ namespace boost                      if(last_reader)                      {                          release_waiters(old_state); -                    } else { -                        release_waiters(old_state);                      } +                    // #7720 +                    //else { +                    //    release_waiters(old_state); +                    //}                      break;                  }                  old_state=current_state; | 
 Swift
 Swift