second pass processes pop operations
| 377 | |
| 378 | // second pass processes pop operations |
| 379 | while (pop_list) { |
| 380 | tmp = pop_list; |
| 381 | pop_list = itt_hide_load_word(pop_list->next); |
| 382 | __TBB_ASSERT(tmp->type == POP_OP, NULL); |
| 383 | if (data.empty()) { |
| 384 | itt_store_word_with_release(tmp->status, uintptr_t(FAILED)); |
| 385 | } |
| 386 | else { |
| 387 | __TBB_ASSERT(mark<=data.size(), NULL); |
| 388 | if (mark < data.size() && |
| 389 | compare(data[0], data[data.size()-1])) { |
| 390 | // there are newly pushed elems and the last one is |
| 391 | // higher than top |
| 392 | *(tmp->elem) = move(data[data.size()-1]); |
| 393 | __TBB_store_with_release(my_size, my_size-1); |
| 394 | itt_store_word_with_release(tmp->status, uintptr_t(SUCCEEDED)); |
| 395 | data.pop_back(); |
| 396 | } |
| 397 | else { // extract top and push last element down heap |
| 398 | *(tmp->elem) = move(data[0]); |
| 399 | __TBB_store_with_release(my_size, my_size-1); |
| 400 | itt_store_word_with_release(tmp->status, uintptr_t(SUCCEEDED)); |
| 401 | reheap(); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | // heapify any leftover pushed elements before doing the next |
| 407 | // batch of operations |
no test coverage detected