diff --git a/cpp/mrc/include/mrc/coroutines/ring_buffer.hpp b/cpp/mrc/include/mrc/coroutines/ring_buffer.hpp index 88605b41b..d266d91c6 100644 --- a/cpp/mrc/include/mrc/coroutines/ring_buffer.hpp +++ b/cpp/mrc/include/mrc/coroutines/ring_buffer.hpp @@ -158,25 +158,44 @@ class RingBuffer return (!m_stopped ? RingBufferOpStatus::Success : RingBufferOpStatus::Stopped); } - WriteOperation& use_scheduling_policy(SchedulePolicy policy) + WriteOperation& use_scheduling_policy(SchedulePolicy policy) & { m_policy = policy; return *this; } - WriteOperation& resume_immediately() + WriteOperation use_scheduling_policy(SchedulePolicy policy) && + { + m_policy = policy; + return std::move(*this); + } + + WriteOperation& resume_immediately() & { m_policy = SchedulePolicy::Immediate; return *this; } - WriteOperation& resume_on(ThreadPool* thread_pool) + WriteOperation resume_immediately() && + { + m_policy = SchedulePolicy::Immediate; + return std::move(*this); + } + + WriteOperation& resume_on(ThreadPool* thread_pool) & { m_policy = SchedulePolicy::Reschedule; set_resume_on_thread_pool(thread_pool); return *this; } + WriteOperation resume_on(ThreadPool* thread_pool) && + { + m_policy = SchedulePolicy::Reschedule; + set_resume_on_thread_pool(thread_pool); + return std::move(*this); + } + private: friend RingBuffer;