| 215 | } |
| 216 | |
| 217 | void LogWorker::process_logs() SKR_NOEXCEPT |
| 218 | { |
| 219 | LogManager::Get()->tscns_.calibrate(); |
| 220 | LogElement e; |
| 221 | |
| 222 | // try flush |
| 223 | while (auto flush_tok = queue_->query_flushing()) |
| 224 | { |
| 225 | SKR_ASSERT(flush_tok->query_status() == kFlushing); |
| 226 | while (queue_->try_dequeue_from(flush_tok, e)) |
| 227 | { |
| 228 | patternAndSink(e); |
| 229 | } |
| 230 | SKR_ASSERT(flush_tok->query_cnt() == 0); |
| 231 | skr_atomic32_cas_relaxed(&flush_tok->flush_status_, kFlushing, kFlushed); |
| 232 | } |
| 233 | |
| 234 | // normal polling |
| 235 | const uint32_t N = 16; // avoid too many logs in one cycle |
| 236 | uint32_t n = 0; |
| 237 | while (queue_->try_dequeue(e)) |
| 238 | { |
| 239 | patternAndSink(e); |
| 240 | |
| 241 | n++; |
| 242 | if (n >= N) break; |
| 243 | } |
| 244 | |
| 245 | // flush sinks |
| 246 | LogManager::Get()->FlushAllSinks(); |
| 247 | } |
| 248 | |
| 249 | void LogWorker::flush(SThreadID tid) SKR_NOEXCEPT |
| 250 | { |
nothing calls this directly
no test coverage detected