MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / ThreadProc

Method ThreadProc

src/base/taskpool.hpp:77–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 return NULL;
76 }
77 void ThreadProc() {
78 while (true) {
79 Task task;
80 {
81 std::unique_lock<std::mutex> lock(mutex_);
82 while (queue_.empty() && !stop_) {
83 work_cv_.wait(lock);
84 }
85 if (stop_ && queue_.empty()) {
86 break;
87 }
88 if (!queue_.empty()) {
89 task = queue_.pop();
90 }
91 queue_cv_.notify_one();
92 }
93 task();
94 }
95 }
96 bool stop_;
97 uint32_t threads_num_;
98 ::fedb::base::RingQueue<Task> queue_;

Callers 1

ThreadWrapperMethod · 0.80

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected