22 #ifndef NDN_DETAIL_CANCEL_HANDLE_HPP 23 #define NDN_DETAIL_CANCEL_HANDLE_HPP 39 : m_cancel(std::move(
cancel))
49 mutable std::function<void()> m_cancel;
57 template<
typename HandleT>
60 static_assert(std::is_convertible<HandleT*, CancelHandle*>::value,
61 "HandleT must publicly derive from CancelHandle");
69 : m_hdl(std::move(hdl))
80 : m_hdl(other.release())
95 m_hdl = other.release();
120 return std::exchange(m_hdl, HandleT{});
124 operator bool() const noexcept
139 #endif // NDN_DETAIL_CANCEL_HANDLE_HPP
CancelHandle(std::function< void()> cancel) noexcept
HandleT release() noexcept
Release the operation so that it won't be cancelled when this ScopedCancelHandle is destructed...
Common includes and macros used throughout the library.
ScopedCancelHandle & operator=(ScopedCancelHandle &&other)
Move assignment operator.
ScopedCancelHandle(ScopedCancelHandle &&other) noexcept
Move constructor.
void cancel()
Cancel the operation.
Handle to cancel an operation.
~ScopedCancelHandle()
Cancel the operation.
ScopedCancelHandle(HandleT hdl) noexcept
Implicit constructor from HandleT.
void cancel() const
Cancel the operation.
Cancels an operation automatically upon destruction.
ScopedCancelHandle() noexcept