get_event<EventT>().trigger(*that(), std::forward<Args>(args)...);
}
- template <class BlockingEventT, class F>
+ template <class BlockingEventT, class InterruptorT=void, class F>
auto with_blocking_event(F&& f) {
- return std::forward<F>(f)(typename BlockingEventT::template Trigger<T>{
+ auto ret = std::forward<F>(f)(typename BlockingEventT::template Trigger<T>{
get_event<BlockingEventT>(), *that()
});
+ if constexpr (std::is_same_v<InterruptorT, void>) {
+ return ret;
+ } else {
+ using ret_t = decltype(ret);
+ return typename InterruptorT::template futurize_t<ret_t>{std::move(ret)};
+ }
}
};
protected:
using TrackableOperationT<T>::TrackableOperationT;
- template <class StageT>
+ template <class InterruptorT=void, class StageT>
auto enter_stage(StageT& stage) {
- return this->template with_blocking_event<typename StageT::BlockingEvent>(
+ return this->template with_blocking_event<typename StageT::BlockingEvent,
+ InterruptorT>(
[&stage, this] (auto&& trigger) {
- return handle.enter<T>(stage, std::move(trigger));
+ return handle.enter<T>(stage, std::move(trigger));
});
}
track_event<StartEvent>();
return seastar::repeat([this, opref=IRef{this}]() mutable {
logger().debug("{}: in repeat", *this);
- return enter_stage(cp().await_map).then([this]() {
+ return enter_stage<>(cp().await_map).then([this]() {
return with_blocking_event<OSD_OSDMapGate::OSDMapBlocker::BlockingEvent>(
[this](auto&& trigger) {
return osd.osdmap_gate.wait_for_map(std::move(trigger),