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

Function ExecuteWithTimeout

tensorflow/core/grappler/utils.cc:198–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198bool ExecuteWithTimeout(std::function<void()> fn, const int64 timeout_in_ms,
199 thread::ThreadPool* const thread_pool) {
200 if (timeout_in_ms <= 0) {
201 fn();
202 return true;
203 }
204 auto done = std::make_shared<Notification>();
205 thread_pool->Schedule([done, fn]() {
206 fn();
207 done->Notify();
208 });
209 const bool notified =
210 WaitForNotificationWithTimeout(done.get(), timeout_in_ms * 1000);
211 return notified;
212}
213
214string AsControlDependency(const NodeDef& node) {
215 return absl::StrCat("^", node.name());

Callers 3

TEST_FFunction · 0.85
RunWithTimeoutMethod · 0.85
CloseSessionMethod · 0.85

Calls 5

fnFunction · 0.50
ScheduleMethod · 0.45
NotifyMethod · 0.45
getMethod · 0.45

Tested by 1

TEST_FFunction · 0.68