MCPcopy Create free account
hub / github.com/apache/brpc / _execute_tasks_pthread

Method _execute_tasks_pthread

src/bthread/execution_queue.cpp:210–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void* ExecutionQueueBase::_execute_tasks_pthread(void* arg) {
211 butil::PlatformThread::SetNameSimple("ExecutionQueue");
212 auto head = (TaskNode*)arg;
213 auto m = (ExecutionQueueBase*)head->q;
214 m->_current_head = head;
215 while (true) {
216 BAIDU_SCOPED_LOCK(m->_mutex);
217 while (!m->_current_head) {
218 m->_cond.Wait();
219 }
220 _execute_tasks(m->_current_head);
221 m->_current_head = NULL;
222
223 int expected = _version_of_id(m->_this_id);
224 if (expected != m->_join_butex->load(butil::memory_order_relaxed)) {
225 // Execute queue has been stopped and stopped task has been executed, quit.
226 break;
227 }
228 }
229 return NULL;
230}
231
232void ExecutionQueueBase::return_task_node(TaskNode* node) {
233 node->clear_before_return(_clear_func);

Callers

nothing calls this directly

Calls 3

_version_of_idFunction · 0.85
WaitMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected