|
cxxmcp 1.1.6
C++ MCP SDK
|
Copyable token observed by cancellation-aware SDK operations. More...
#include <cancellation.hpp>
Public Member Functions | |
| CancellationToken () | |
| Constructs a detached token (same as none()). | |
| bool | cancelled () const noexcept |
| Returns true after the associated source has requested cancellation. | |
| bool | cancellable () const noexcept |
| Returns true when this token is attached to a cancellation source. | |
| bool | wait_for_cancel () const |
| Block until cancellation is requested. | |
| bool | wait_for_cancel (std::chrono::milliseconds timeout) const |
| Block until cancellation is requested or timeout expires. | |
| bool | wait_for_cancel (std::chrono::steady_clock::time_point deadline) const |
| Block until cancellation is requested or deadline is reached. | |
Static Public Member Functions | |
| static CancellationToken | none () |
| Constructs a detached token that is never cancelled. | |
Friends | |
| class | CancellationSource |
| detail::CancellationRegistration | detail::register_cancellation_callback (CancellationToken token, std::function< void()> callback) |
Copyable token observed by cancellation-aware SDK operations.
|
inlinestatic |
Constructs a detached token that is never cancelled.
Use this when no cancellation source is needed. The token's cancelled() always returns false and wait_for_cancel() returns false immediately.
|
inline |
Block until cancellation is requested.
Returns true when cancelled. CV-based, no polling.
|
inline |
Block until cancellation is requested or timeout expires.
Returns true if cancelled, false if timeout.
|
inline |
Block until cancellation is requested or deadline is reached.
Returns true if cancelled, false if deadline passed.