Пример #1
0
 bool priv_timed_lock(sync::detail::chrono_time_point< TimePoint > const& t)
 {
     typedef TimePoint time_point;
     typedef typename time_point::clock clock;
     typedef typename time_point::duration duration;
     time_point now = clock::now();
     while (now < t.get())
     {
         if (priv_timed_lock(sync::detail::time_traits< duration >::to_sync_unit(t.get() - now)))
             return true;
         now = clock::now();
     }
     return false;
 }
Пример #2
0
 sync::cv_status priv_timed_wait(unique_lock< Mutex >& lock, sync::detail::chrono_time_point< TimePoint > const& t)
 {
     typedef TimePoint time_point;
     typedef typename time_point::clock clock;
     typedef typename time_point::duration duration;
     time_point now = clock::now();
     while (now < t.get())
     {
         if (priv_timed_wait(lock, sync::detail::time_traits< duration >::to_sync_unit(t.get() - now)) == sync::cv_status::no_timeout)
             return sync::cv_status::no_timeout;
         now = clock::now();
     }
     return sync::cv_status::timeout;
 }