| 247 | } |
| 248 | |
| 249 | void 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 | |
| 270 | skr::AsyncResult LogWorker::serve() SKR_NOEXCEPT |
| 271 | { |
no test coverage detected