| 68 | } |
| 69 | |
| 70 | void WorkerLoop(vm::ThreadCtx* thread_ctx, const std::function<void(vm::ThreadCtx*)>& Initializer) { |
| 71 | SyncVmModeGuard guard(SyncVmMode::kEnable); |
| 72 | Initializer(thread_ctx); |
| 73 | constexpr static size_t kExpireMicroseconds = 200; |
| 74 | while (thread_ctx->mut_notifier()->WaitAndClearNotifiedCnt() == kNotifierStatusSuccess) { |
| 75 | std::chrono::time_point<std::chrono::steady_clock> start{}; |
| 76 | do { |
| 77 | while (thread_ctx->TryReceiveAndRun()) { start = std::chrono::steady_clock::now(); } |
| 78 | std::this_thread::yield(); |
| 79 | } while (MicrosecondsFrom(start) < kExpireMicroseconds); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | } // namespace |
| 84 |
nothing calls this directly
no test coverage detected