MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / AddTasks

Method AddTasks

TombEngine/Specific/Parallel.cpp:76–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 }
75
76 std::future<void> ParallelTaskManager::AddTasks(const ParallelTasks& tasks)
77 {
78 // HEAP ALLOC: Create counter and promise.
79 auto counter = std::make_shared<std::atomic<int>>();
80 auto promise = std::make_shared<std::promise<void>>();
81
82 // Add group tasks.
83 counter->store((int)tasks.size(), std::memory_order_release);
84 for (const auto& task : tasks)
85 AddTask(task, counter, promise);
86
87 // Notify available threads to handle tasks.
88 _taskCond.notify_all();
89
90 // Return future to wait on task group completion if needed.
91 return promise->get_future();
92 }
93
94 std::future<void> ParallelTaskManager::AddTasks(int elementCount, const std::function<void(int, int)>& splitTask)
95 {

Callers 2

DrawSpritesMethod · 0.80
UpdateDebrisFunction · 0.80

Calls 5

storeMethod · 0.80
GetSettingsMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected