MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RegisterCall

Method RegisterCall

tensorflow/core/distributed_runtime/base_rendezvous_mgr.cc:869–898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

867}
868
869void BaseRemoteRendezvous::RegisterCall(BaseRecvTensorCall* call,
870 const Rendezvous::Args& args) {
871 CancellationManager* cm = args.cancellation_manager;
872 {
873 mutex_lock l(mu_);
874 if (!status_.ok()) {
875 call->StartAbort(status_);
876 return;
877 }
878 bool already_cancelled = false;
879 InactiveCallback callback = [] {};
880 if (cm != nullptr) {
881 auto token = cm->get_cancellation_token();
882 already_cancelled = !cm->RegisterCallback(token, [this, call] {
883 {
884 mutex_lock l(mu_);
885 if (active_.find(call) == active_.end()) return;
886 call->StartAbort(
887 errors::Cancelled("RecvFromRemoteAsync is cancelled."));
888 }
889 });
890 callback = [cm, token] { cm->TryDeregisterCallback(token); };
891 }
892 if (already_cancelled) {
893 call->StartAbort(errors::Cancelled("RecvFromRemoteAsync is cancelled."));
894 } else {
895 CHECK(active_.emplace(call, callback).second);
896 }
897 }
898}
899
900void BaseRemoteRendezvous::DeregisterCall(BaseRecvTensorCall* call) {
901 mutex_lock l(mu_);

Callers 1

CreateCallMethod · 0.45

Calls 9

CancelledFunction · 0.85
TryDeregisterCallbackMethod · 0.80
okMethod · 0.45
StartAbortMethod · 0.45
RegisterCallbackMethod · 0.45
findMethod · 0.45
endMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected