Skip to content

Instantly share code, notes, and snippets.

@cbodley
Created January 23, 2023 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbodley/e62acbb2e491268c6661a5b5e33c72f1 to your computer and use it in GitHub Desktop.
Save cbodley/e62acbb2e491268c6661a5b5e33c72f1 to your computer and use it in GitHub Desktop.
diff --git a/src/neorados/cls/common.h b/src/neorados/cls/common.h
index 6b39ea4b295..b1dd4b320ab 100644
--- a/src/neorados/cls/common.h
+++ b/src/neorados/cls/common.h
@@ -95,11 +95,15 @@ auto exec(
method = std::move(method), in = std::move(in),
f = std::move(f)](auto& self) {
auto e = self.get_executor();
+ using executor_type = decltype(e);
+ using awaitable_void = asio::awaitable<void, executor_type>;
+ using use_awaitable_t = asio::use_awaitable_t<executor_type>;
+ static constexpr use_awaitable_t use_awaitable;
co_spawn(
e,
[](auto self, RADOS& r, Object oid, IOContext ioc,
std::string cls, std::string method, buffer::list in,
- auto&& f) -> asio::awaitable<void, decltype(e)> {
+ auto&& f) -> awaitable_void {
try {
ReadOp op;
buffer::list out;
@@ -110,7 +114,7 @@ auto exec(
co_return;
}
co_await r.execute(std::move(oid), std::move(ioc), std::move(op),
- nullptr, asio::use_awaitable);
+ nullptr, use_awaitable);
Rep rep;
decode(rep, out);
self.complete({}, std::invoke(std::move(f), rep));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment