| 300 | } |
| 301 | |
| 302 | int ExecutionQueueBase::_execute(TaskNode* head, bool high_priority, int* niterated) { |
| 303 | if (head != NULL && head->stop_task) { |
| 304 | CHECK(head->next == NULL); |
| 305 | head->iterated = true; |
| 306 | head->status = TaskNode::EXECUTED; |
| 307 | TaskIteratorBase iter(NULL, this, true, false); |
| 308 | _execute_func(_meta, _type_specific_function, iter); |
| 309 | if (niterated) { |
| 310 | *niterated = 1; |
| 311 | } |
| 312 | return ESTOP; |
| 313 | } |
| 314 | TaskIteratorBase iter(head, this, false, high_priority); |
| 315 | if (iter) { |
| 316 | _execute_func(_meta, _type_specific_function, iter); |
| 317 | } |
| 318 | // We must assign |niterated| with num_iterated even if we couldn't peek |
| 319 | // any task to execute at the begining, in which case all the iterated |
| 320 | // tasks have been cancelled at this point. And we must return the |
| 321 | // correct num_iterated() to the caller to update the counter correctly. |
| 322 | if (niterated) { |
| 323 | *niterated = iter.num_iterated(); |
| 324 | } |
| 325 | return 0; |
| 326 | } |
| 327 | |
| 328 | TaskNode* ExecutionQueueBase::allocate_node() { |
| 329 | get_execq_vars()->running_task_count << 1; |
no test coverage detected