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

Function push

src/UtilsCtrl/ThreadPool/Queue/UWorkStealingQueue.h:30–40  ·  view source on GitHub ↗

* 向队列中写入信息 * @param task */

Source from the content-addressed store, hash-verified

28 * @param task
29 */
30 CVoid push(UTask&& task) {
31 while (true) {
32 if (mutex_.try_lock()) {
33 deque_.emplace_front(std::move(task));
34 mutex_.unlock();
35 break;
36 } else {
37 std::this_thread::yield();
38 }
39 }
40 }
41
42
43 /**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected