25#include <condition_variable>
37 std::condition_variable _cv;
38 std::exception_ptr _exception;
39 void interrupt_ptr(std::exception_ptr e) {
40 std::unique_lock<std::mutex> lock(_mutex);
53 std::optional<T> _element;
56 template <
typename Exception>
57 void interrupt(Exception e) {
61 interrupt_ptr(std::current_exception());
65 std::unique_lock<std::mutex> lock(_mutex);
66 _cv.wait(lock, [
this] {
return !_element || _exception; });
68 std::rethrow_exception(_exception);
74 std::unique_lock<std::mutex> lock(_mutex);
75 _cv.wait(lock, [
this] {
return bool(_element) || _exception; });
77 std::rethrow_exception(_exception);
Definition: exchanger.hh:32
Definition: exchanger.hh:51
Seastar API namespace.
Definition: abort_on_ebadf.hh:26