File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1- /* Copyright 2023 Diligent Graphics LLC
1+ /* Copyright 2023-2024 Diligent Graphics LLC
22
33 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -250,6 +250,20 @@ class ObjectsRegistry
250250 PurgeUnguarded ();
251251 }
252252
253+ // / Processes each element in the cache with the specified handler.
254+ template <typename HandlerType>
255+ void ProcessElements (HandlerType&& Handler)
256+ {
257+ std::lock_guard<std::mutex> Guard{m_CacheMtx};
258+ for (auto & Entry : m_Cache)
259+ {
260+ if (auto pObject = Entry.second ->Lock ())
261+ {
262+ Handler (Entry.first , *pObject);
263+ }
264+ }
265+ }
266+
253267private:
254268 class ObjectWrapper
255269 {
You can’t perform that action at this time.
0 commit comments