MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / update

Method update

Examples/SCExample/HotReloadSystem.h:196–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194 }
195
196 Result update()
197 {
198 if (not pendingReload.pending)
199 {
200 return Result(true);
201 }
202 const Time::Relative elapsed =
203 Time::HighResolutionCounter().snap().subtractApproximate(pendingReload.lastEvent);
204 if (elapsed < Time::Milliseconds(250))
205 {
206 return Result(true);
207 }
208
209 auto reload = [this](const PluginIdentifier& plugin) { (void)load(plugin.view()); };
210 if (pendingReload.reloadAll)
211 {
212 registry.getPluginsToReloadBecauseOf(StringSpan(), Time::Milliseconds(-1), reload);
213 }
214 else
215 {
216 registry.getPluginsToReloadBecauseOf(pendingReload.relativePath.view(), Time::Milliseconds(-1), reload);
217 }
218 pendingReload = {};
219 return Result(true);
220 }
221
222 private:
223 AsyncEventLoop* eventLoop = nullptr;

Callers 2

cache_downloadFunction · 0.45

Calls 7

MillisecondsClass · 0.85
StringSpanFunction · 0.85
subtractApproximateMethod · 0.80
ResultClass · 0.50
viewMethod · 0.45

Tested by

no test coverage detected