MCPcopy Create free account
hub / github.com/Tencent/tgfx / pushTask

Method pushTask

src/core/utils/TaskGroup.cpp:109–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109bool TaskGroup::pushTask(std::shared_ptr<Task> task, TaskPriority priority) {
110#ifndef TGFX_USE_THREADS
111 return false;
112#endif
113 if (exited || !checkThreads()) {
114 return false;
115 }
116 auto& queue = priorityQueues[static_cast<size_t>(priority)];
117 if (!queue->enqueue(task)) {
118 return false;
119 }
120 if (waitingThreads > 0) {
121 condition.notify_one();
122 }
123 return true;
124}
125
126std::shared_ptr<Task> TaskGroup::popTask() {
127 std::unique_lock<std::mutex> autoLock(locker);

Callers 1

RunMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected