MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / CancellationToken

Class CancellationToken

src/server/server.hpp:70–93  ·  view source on GitHub ↗

Cancellation token for request cancellation

Source from the content-addressed store, hash-verified

68
69// Cancellation token for request cancellation
70struct CancellationToken {
71 std::atomic<bool> is_cancelled;
72 std::atomic<bool> is_completed;
73 std::weak_ptr<HttpSession> session;
74
75 CancellationToken(std::shared_ptr<HttpSession> s) : is_cancelled(false), is_completed(false), session(s) {}
76
77 void cancel() {
78 is_cancelled.store(true);
79 }
80 void complete() {
81 is_completed.store(true);
82 }
83 void reset() noexcept {
84 is_cancelled.store(false, std::memory_order_relaxed);
85 is_completed.store(false, std::memory_order_relaxed);
86 }
87 bool cancelled() const {
88 return is_cancelled.load();
89 }
90 bool completed() const {
91 return is_completed.load();
92 }
93};
94
95// Request handler callback type
96using RequestHandler = std::function<void(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected