MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / cancelTask

Method cancelTask

Telegram/SourceFiles/storage/localimageloader.cpp:262–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void TaskQueue::cancelTask(TaskId id) {
263 const auto removeFrom = [&](std::deque<std::unique_ptr<Task>> &queue) {
264 const auto proj = [](const std::unique_ptr<Task> &task) {
265 return task->id();
266 };
267 auto i = ranges::find(queue, id, proj);
268 if (i != queue.end()) {
269 queue.erase(i);
270 }
271 };
272 {
273 QMutexLocker lock(&_tasksToProcessMutex);
274 removeFrom(_tasksToProcess);
275 if (_taskInProcessId == id) {
276 _taskInProcessId = TaskId();
277 }
278 }
279 QMutexLocker lock(&_tasksToFinishMutex);
280 removeFrom(_tasksToFinish);
281}
282
283void TaskQueue::onTaskProcessed() {
284 do {

Callers 1

cancelTaskFunction · 0.80

Calls 3

idMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected