| 208 | } |
| 209 | |
| 210 | void* 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 | |
| 232 | void ExecutionQueueBase::return_task_node(TaskNode* node) { |
| 233 | node->clear_before_return(_clear_func); |
nothing calls this directly
no test coverage detected