AioResultList drain() override final;
};
-#ifdef HAVE_BOOST_CONTEXT
// a throttle that yields the coroutine instead of blocking. all public
// functions must be called within the coroutine strand
class YieldingAioThrottle final : public Aio, private Throttle {
AioResultList drain() override final;
};
-#endif // HAVE_BOOST_CONTEXT
// return a smart pointer to Aio
inline auto make_throttle(uint64_t window_size, optional_yield y)
{
-#ifdef HAVE_BOOST_CONTEXT
std::unique_ptr<Aio> aio;
if (y) {
aio = std::make_unique<YieldingAioThrottle>(window_size,
aio = std::make_unique<BlockingAioThrottle>(window_size);
}
return aio;
-#else
- return std::make_optional<BlockingAioThrottle>(window_size);
-#endif
}
} // namespace rgw