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

Method flush

modules/core/core/src/core/log/log_worker.cpp:249–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249void LogWorker::flush(SThreadID tid) SKR_NOEXCEPT
250{
251 queue_->mark_flushing(tid);
252 this->awake();
253 if (auto tok = queue_->query_token(tid))
254 {
255 while (skr_atomic32_load_relaxed(&tok->flush_status_) != kFlushed)
256 {
257 if (this->t.get_id() == tid) // flush self
258 process_logs();
259 else
260 skr_thread_sleep(0);
261 }
262 SKR_ASSERT(skr_atomic64_load_relaxed(&tok->tls_cnt_) == 0);
263 LogManager::Get()->FlushAllSinks();
264 skr_atomic32_cas_relaxed(&tok->flush_status_, kFlushed, kNoFlush);
265 }
266 else
267 SKR_UNREACHABLE_CODE();
268}
269
270skr::AsyncResult LogWorker::serve() SKR_NOEXCEPT
271{

Callers 1

skr_log_flushFunction · 0.45

Calls 9

skr_atomic32_cas_relaxedFunction · 0.85
mark_flushingMethod · 0.80
query_tokenMethod · 0.80
FlushAllSinksMethod · 0.80
skr_thread_sleepFunction · 0.50
GetFunction · 0.50
get_idMethod · 0.45

Tested by

no test coverage detected