Browse Source

删除event不必要的代码

tags/v2.9.7
tearshark 4 years ago
parent
commit
474f6fa04f
3 changed files with 4 additions and 18 deletions
  1. 0
    5
      librf/src/event_v2.cpp
  2. 0
    11
      librf/src/event_v2.h
  3. 4
    2
      librf/src/event_v2.inl

+ 0
- 5
librf/src/event_v2.cpp View File

event_t::~event_t() event_t::~event_t()
{ {
} }

event_t::timeout_awaiter event_t::wait_until_(const clock_type::time_point& tp) const noexcept
{
return { tp, _event.get() };
}
} }
} }

+ 0
- 11
librf/src/event_v2.h View File

event_t& operator = (const event_t&) = default; event_t& operator = (const event_t&) = default;
event_t& operator = (event_t&&) = default; event_t& operator = (event_t&&) = default;
private: private:
//friend struct any_awaiter;

event_impl_ptr _event; event_impl_ptr _event;

timeout_awaiter wait_until_(const clock_type::time_point& tp) const noexcept;
inline static bool is_all_succeeded(const std::vector<bool>& v)
{
return std::none_of(std::begin(v), std::end(v), [](auto v)
{
return v == false;
});
}
}; };
} }
} }

+ 4
- 2
librf/src/event_v2.inl View File

template<class _Rep, class _Period> template<class _Rep, class _Period>
inline event_t::timeout_awaiter event_t::wait_for(const std::chrono::duration<_Rep, _Period>& dt) const noexcept inline event_t::timeout_awaiter event_t::wait_for(const std::chrono::duration<_Rep, _Period>& dt) const noexcept
{ {
return wait_until_(clock_type::now() + std::chrono::duration_cast<clock_type::duration>(dt));
clock_type::time_point tp2 = clock_type::now() + std::chrono::duration_cast<clock_type::duration>(dt);
return { tp2, _event.get() };
} }
template<class _Clock, class _Duration> template<class _Clock, class _Duration>
inline event_t::timeout_awaiter event_t::wait_until(const std::chrono::time_point<_Clock, _Duration>& tp) const noexcept inline event_t::timeout_awaiter event_t::wait_until(const std::chrono::time_point<_Clock, _Duration>& tp) const noexcept
{ {
return wait_until_(std::chrono::time_point_cast<clock_type::duration>(tp));
clock_type::time_point tp2 = std::chrono::time_point_cast<clock_type::duration>(tp);
return { tp2, _event.get() };
} }

Loading…
Cancel
Save