MCPcopy Create free account
hub / github.com/apache/singa / TryPop

Method TryPop

include/singa/utils/safe_queue.h:86–94  ·  view source on GitHub ↗

* Try to pop an element from the queue. * \return false the queue is empty now. */

Source from the content-addressed store, hash-verified

84 * \return false the queue is empty now.
85 */
86 bool TryPop(T& e) {
87 std::unique_lock<std::mutex> lock(mutex_);
88
89 if (queue_.empty()) return false;
90
91 e = queue_.front();
92 queue_.pop();
93 return true;
94 }
95
96 /**
97 * @return Number of elements in the queue.

Callers 1

TryPopMethod · 0.45

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected