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

Method WaitFor

tensorflow/core/lib/core/blocking_counter.h:58–69  ·  view source on GitHub ↗

Wait for the specified time, return false iff the count has not dropped to zero before the timeout expired.

Source from the content-addressed store, hash-verified

56 // Wait for the specified time, return false iff the count has not dropped to
57 // zero before the timeout expired.
58 inline bool WaitFor(std::chrono::milliseconds ms) {
59 unsigned int v = state_.fetch_or(1, std::memory_order_acq_rel);
60 if ((v >> 1) == 0) return true;
61 mutex_lock l(mu_);
62 while (!notified_) {
63 const std::cv_status status = cond_var_.wait_for(l, ms);
64 if (status == std::cv_status::timeout) {
65 return false;
66 }
67 }
68 return true;
69 }
70
71 private:
72 mutex mu_;

Callers 4

WaitAndLogIfStuckFunction · 0.80
WaitAndLogIfStuckFunction · 0.80
TESTFunction · 0.80
StartMethod · 0.80

Calls 1

wait_forMethod · 0.80

Tested by 1

TESTFunction · 0.64