22 #ifndef NDN_CXX_DETAIL_CANCEL_HANDLE_HPP
23 #define NDN_CXX_DETAIL_CANCEL_HANDLE_HPP
26 #include <type_traits>
44 : m_cancel(std::move(
cancel))
54 mutable std::function<void()> m_cancel;
63 template<typename HandleT>
66 static_assert(std::is_convertible_v<HandleT*, CancelHandle*>,
67 "HandleT must publicly derive from CancelHandle");
75 : m_hdl(std::move(hdl))
86 : m_hdl(other.release())
101 m_hdl = other.release();
126 return std::exchange(m_hdl, HandleT{});
130 operator bool() const noexcept
Handle to cancel an operation.
void cancel() const
Cancel the operation.
Cancels an operation automatically upon destruction.
ScopedCancelHandle() noexcept
~ScopedCancelHandle()
Cancel the operation.
ScopedCancelHandle(const ScopedCancelHandle &)=delete
Copy construction is disallowed.
ScopedCancelHandle(ScopedCancelHandle &&other) noexcept
Move constructor.
HandleT release() noexcept
Release the operation so that it won't be cancelled when this ScopedCancelHandle is destructed.
ScopedCancelHandle & operator=(ScopedCancelHandle &&other)
Move assignment operator.
ScopedCancelHandle & operator=(const ScopedCancelHandle &)=delete
Copy assignment is disallowed.
void cancel()
Cancel the operation.
Contains implementation details that are not part of the ndn-cxx public API.