MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / WorkerLoop

Function WorkerLoop

oneflow/core/vm/virtual_machine.cpp:70–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void 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

Callers

nothing calls this directly

Calls 4

MicrosecondsFromFunction · 0.85
TryReceiveAndRunMethod · 0.80
mut_notifierMethod · 0.45

Tested by

no test coverage detected