MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / wait_until

Function wait_until

include/BS_thread_pool.hpp:2029–2050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2027 */
2028 template <typename C, typename D>
2029 bool wait_until(const std::chrono::time_point<C, D>& timeout_time)
2030 {
2031#ifdef __cpp_exceptions
2032 if constexpr (wait_deadlock_checks_enabled)
2033 {
2034 if (this_thread::get_pool() == this)
2035 throw wait_deadlock();
2036 }
2037#endif
2038 std::unique_lock tasks_lock(tasks_mutex);
2039 waiting = true;
2040 const bool status = tasks_done_cv.wait_until(tasks_lock, timeout_time,
2041 [this]
2042 {
2043 if constexpr (pause_enabled)
2044 return (tasks_running == 0) && (paused || tasks.empty());
2045 else
2046 return (tasks_running == 0) && tasks.empty();
2047 });
2048 waiting = false;
2049 return status;
2050 }
2051
2052private:
2053 // ========================

Callers

nothing calls this directly

Calls 2

wait_deadlockClass · 0.85
wait_untilMethod · 0.80

Tested by

no test coverage detected