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

Method TryLock

oneflow/core/control/rpc_client.cpp:70–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70TryLockResult RpcClient::TryLock(const std::string& name) {
71 {
72 std::unique_lock<std::mutex> lck(done_names_mtx_);
73 if (done_names_.find(name) != done_names_.end()) { return TryLockResult::kDone; }
74 }
75 ClientCall<CtrlMethod::kTryLock> call;
76 call.mut_request()->set_name(name);
77 call(GetResponsibleStub(name));
78 if (call.response().result() == TryLockResult::kDone) {
79 std::unique_lock<std::mutex> lck(done_names_mtx_);
80 done_names_.insert(name);
81 }
82 return call.response().result();
83}
84
85void RpcClient::NotifyDone(const std::string& name) {
86 ClientCall<CtrlMethod::kNotifyDone> call;

Callers

nothing calls this directly

Calls 5

callFunction · 0.85
findMethod · 0.80
insertMethod · 0.80
endMethod · 0.45
mut_requestMethod · 0.45

Tested by

no test coverage detected