1 #ifndef BOOST_FIBERS_WAKER_H
2 #define BOOST_FIBERS_WAKER_H
6 #include <boost/config.hpp>
7 #include <boost/fiber/detail/config.hpp>
8 #include <boost/fiber/detail/spinlock.hpp>
9 #include <boost/intrusive/slist.hpp>
18 typedef intrusive::slist_member_hook<> waker_queue_hook;
23 class BOOST_FIBERS_DECL waker {
33 waker(context * ctx, const size_t epoch)
38 bool wake() const noexcept;
42 class BOOST_FIBERS_DECL waker_with_hook : public waker {
44 explicit waker_with_hook(waker && w)
45 : waker{ std::move(w) }
48 bool is_linked() const noexcept {
49 return waker_queue_hook_.is_linked();
53 operator==( waker const& lhs, waker const& rhs) noexcept {
54 return & lhs == & rhs;
58 detail::waker_queue_hook waker_queue_hook_{};
62 typedef intrusive::slist<
64 intrusive::member_hook<
65 waker_with_hook, detail::waker_queue_hook, & waker_with_hook::waker_queue_hook_ >,
66 intrusive::constant_time_size< false >,
67 intrusive::cache_last< true >
71 class BOOST_FIBERS_DECL wait_queue {
73 detail::waker_slist_t slist_{};
76 void suspend_and_wait( detail::spinlock_lock &, context *);
77 bool suspend_and_wait_until( detail::spinlock_lock &,
79 std::chrono::steady_clock::time_point const&);
88 #endif // BOOST_FIBERS_WAKER_H