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

Method asyncEnter

valdi_core/src/valdi_core/cpp/Threading/GCDDispatchQueue.cpp:121–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121void GCDDispatchQueue::asyncEnter(const DispatchFunction& function) {
122 // Check if destroyed before acquiring execution lock
123 if (wasDestroyed()) {
124 decrementPendingTaskCount();
125 return;
126 }
127
128 // Acquire lock to protect function execution
129 std::lock_guard<std::timed_mutex> lock(_executionMutex);
130
131 // Double-check after acquiring lock (in case teardown happened between checks)
132 if (wasDestroyed()) {
133 decrementPendingTaskCount();
134 return;
135 }
136
137 // Safe to execute - teardown will wait for lock to be released
138 function();
139
140 decrementPendingTaskCount();
141}
142
143bool GCDDispatchQueue::removeTaskId(task_id_t id) {
144 std::lock_guard<Mutex> guard(_mutex);

Callers 1

performMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected