MCPcopy Create free account
hub / github.com/apache/trafficserver / cancel

Method cancel

src/tscpp/api/AsyncTimer.cc:98–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void
99AsyncTimer::cancel()
100{
101 // Assume this object is locked and the state isn't being updated elsewhere.
102 // Note that is not the same as the contained continuation being locked.
103 TSCont contp{state_->cont_}; // save this
104 if (!contp) {
105 LOG_DEBUG("Already canceled");
106 return;
107 }
108
109 auto mutex{TSContMutexGet(contp)};
110 TSMutexLock(mutex); // prevent event dispatch for the continuation during this cancel.
111
112 if (state_->initial_timer_action_) {
113 LOG_DEBUG("Canceling initial timer action");
114 TSActionCancel(state_->initial_timer_action_);
115 }
116 if (state_->periodic_timer_action_) {
117 LOG_DEBUG("Canceling periodic timer action");
118 TSActionCancel(state_->periodic_timer_action_);
119 }
120 state_->cont_ = nullptr;
121
122 TSMutexUnlock(mutex);
123
124 LOG_DEBUG("Destroying cont");
125 TSContDestroy(contp);
126}
127
128AsyncTimer::~AsyncTimer()
129{

Callers 1

TSActionCancelFunction · 0.45

Calls 5

TSContMutexGetFunction · 0.85
TSMutexLockFunction · 0.85
TSActionCancelFunction · 0.85
TSMutexUnlockFunction · 0.85
TSContDestroyFunction · 0.85

Tested by

no test coverage detected