MCPcopy Create free account
hub / github.com/Snapchat/Valdi / cancel

Method cancel

valdi_core/src/valdi_core/cpp/Utils/ResolvablePromise.cpp:85–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void ResolvablePromise::cancel() {
86 std::unique_lock<Mutex> lock(_mutex);
87 if (_canceled) {
88 return;
89 }
90 _canceled = true;
91 auto cancelCallback = std::move(_cancelCallback);
92 _cancelCallback = {}; // clear after move
93 lock.unlock();
94
95 if (cancelCallback) {
96 cancelCallback();
97 }
98}
99
100void ResolvablePromise::setCancelCallback(DispatchFunction cancelCallback) {
101 std::unique_lock<Mutex> lock(_mutex);

Callers

nothing calls this directly

Calls 1

unlockMethod · 0.45

Tested by

no test coverage detected