File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ export namespace CppUtils::Container
188188
189189 inline auto updateDistance(const WeakPtr& lockedParentWeak = {}, std::size_t lockedParentDistance = std::numeric_limits<std::size_t>::max()) -> void
190190 {
191- auto oldDistanceFromRoot = m_distanceFromRoot;
191+ const auto oldDistanceFromRoot = m_distanceFromRoot;
192192
193193 m_distanceFromRoot = std::numeric_limits<std::size_t>::max();
194194 for (const auto& parentWeak : m_parents)
Original file line number Diff line number Diff line change @@ -111,13 +111,16 @@ export namespace CppUtils::Thread
111111
112112 inline auto flush() -> void
113113 {
114- auto tasksToRun = std::vector<std::shared_ptr<Item>>{};
114+ while (true)
115115 {
116- auto accessor = m_items.access();
117- auto& [set, map, processingTasks] = accessor.value();
118-
119- if (not std::empty(set))
116+ auto tasksToRun = std::vector<std::shared_ptr<Item>>{};
120117 {
118+ auto accessor = m_items.access();
119+ auto& [set, map, processingTasks] = accessor.value();
120+
121+ if (std::empty(set))
122+ break;
123+
121124 tasksToRun.assign(std::begin(set), std::end(set));
122125 processingTasks += std::size(set);
123126 map.clear();
@@ -126,11 +129,10 @@ export namespace CppUtils::Thread
126129 m_workCondition.notify_all();
127130 m_finishedCondition.notify_all();
128131 }
132+ dispatchTasks(std::move(tasksToRun));
129133 }
130-
131- dispatchTasks(std::move(tasksToRun));
132-
133- waitUntilFinished();
134+ m_workCondition.notify_all();
135+ m_finishedCondition.notify_all();
134136 }
135137
136138 inline auto cancel(std::size_t id) -> void
You can’t perform that action at this time.
0 commit comments