MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / sync_entry

Method sync_entry

modules/engine/runtime/src/ecs/scheduler.cpp:99–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99bool sugoi::scheduler_t::sync_entry(sugoi::archetype_t* type, sugoi_type_index_t i, bool readonly)
100{
101 SKR_ASSERT(is_main_thread(type->storage));
102 // TODO: performance optimization
103 skr::stl_vector<skr::task::event_t> deps;
104
105 {
106 SMutexLock entryLock(entryMutex.mMutex);
107 auto pair = dependencyEntries.find(type);
108 if (pair == dependencyEntries.end())
109 return false;
110 auto entries = pair->second.data();
111 for (auto dep : entries[i].owned)
112 if(auto ptr = dep.lock())
113 deps.push_back(ptr);
114 if(!readonly)
115 {
116 for (auto p : entries[i].shared)
117 if(auto ptr = p.lock())
118 deps.push_back(ptr);
119 entries[i].shared.clear();
120 }
121 entries[i].owned.clear();
122 }
123
124 for (auto dep : deps)
125 dep.wait(true);
126 return !deps.empty();
127}
128
129bool sugoi::scheduler_t::sync_query(sugoi_query_t* query)
130{

Callers 2

sugoiS_queryFunction · 0.80
sugoiV_get_ownedFunction · 0.80

Calls 8

findMethod · 0.45
endMethod · 0.45
dataMethod · 0.45
lockMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45
waitMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected