Skip to content

Commit

Permalink
make available_promise support variable templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rystsov committed Jun 23, 2022
1 parent f5aec8b commit 93b8bd4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/v/utils/available_promise.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@

#include <seastar/core/future.hh>

template<typename T>
template<class... T>
class available_promise {
public:
ss::future<T> get_future() { return _promise.get_future(); }
ss::future<T...> get_future() { return _promise.get_future(); }

void set_value(T&& value) {
template<typename... A>
void set_value(A&&... a) {
_available = true;
_promise.set_value(std::move(value));
_promise.set_value(std::forward<A>(a)...);
}

bool available() { return _available; }

private:
bool _available{false};
ss::promise<T> _promise;
ss::promise<T...> _promise;
};

0 comments on commit 93b8bd4

Please sign in to comment.