cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
mcp::CancellationState Struct Reference

Shared state backing a cancellation token/source pair. More...

#include <cancellation.hpp>

Public Attributes

std::atomic_bool cancelled {false}
 
std::mutex mutex
 
std::condition_variable cv
 
std::size_t next_callback_id = 1
 
std::vector< std::pair< std::size_t, std::function< void()> > > callbacks
 

Detailed Description

Shared state backing a cancellation token/source pair.

The atomic flag provides a fast-path check for cancelled(). The mutex and condition variable are only used when wait_for_cancel() is called. This keeps the common path (polling cancelled()) allocation-free after the initial CancellationState construction.


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