MCPcopy Create free account
hub / github.com/ChunelFeng/CThreadPool / tryPop

Function tryPop

src/UtilsCtrl/ThreadPool/Queue/UAtomicQueue.h:93–99  ·  view source on GitHub ↗

* 非阻塞式等待弹出 * @return */

Source from the content-addressed store, hash-verified

91 * @return
92 */
93 std::unique_ptr<T> tryPop() {
94 CGRAPH_LOCK_GUARD lk(mutex_);
95 if (queue_.empty()) { return std::unique_ptr<T>(); }
96 std::unique_ptr<T> ptr = std::move(queue_.front());
97 queue_.pop();
98 return ptr;
99 }
100
101
102 /**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected