Bitcoin Core 30.99.0
P2P Digital Currency
Public Member Functions | Public Attributes | List of all members
mp::CancelMonitor Class Reference

Helper class that detects when a promise is canceled. More...

#include <util.h>

Collaboration diagram for mp::CancelMonitor:
[legend]

Public Member Functions

 ~CancelMonitor ()
 
void promiseDestroyed (CancelProbe &probe)
 

Public Attributes

bool m_canceled {false}
 
std::function< void()> m_on_cancel
 
CancelProbem_probe {nullptr}
 

Detailed Description

Helper class that detects when a promise is canceled.

Used to detect canceled requests and prevent potential crashes on unclean disconnects.

In the future, this could also be used to support a way for wrapped C++ methods to detect cancellation (like approach #4 in https://github.com/bitcoin/bitcoin/issues/33575).

Definition at line 292 of file util.h.

Constructor & Destructor Documentation

◆ ~CancelMonitor()

mp::CancelMonitor::~CancelMonitor ( )
inline

Definition at line 319 of file util.h.

Here is the call graph for this function:

Member Function Documentation

◆ promiseDestroyed()

void mp::CancelMonitor::promiseDestroyed ( CancelProbe probe)
inline

Definition at line 328 of file util.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_canceled

bool mp::CancelMonitor::m_canceled {false}

Definition at line 298 of file util.h.

◆ m_on_cancel

std::function<void()> mp::CancelMonitor::m_on_cancel

Definition at line 299 of file util.h.

◆ m_probe

CancelProbe* mp::CancelMonitor::m_probe {nullptr}

Definition at line 300 of file util.h.


The documentation for this class was generated from the following file: