| 2325 | } |
| 2326 | } |
| 2327 | MOODYCAMEL_CATCH (...) { |
| 2328 | // It's too late to revert the dequeue, but we can make sure that all |
| 2329 | // the dequeued objects are properly destroyed and the block index |
| 2330 | // (and empty count) are properly updated before we propagate the exception |
| 2331 | do { |
| 2332 | block = localBlockIndex->entries[indexIndex].block; |
| 2333 | while (index != endIndex) { |
| 2334 | (*block)[index++]->~T(); |
| 2335 | } |
| 2336 | block->ConcurrentQueue::Block::template set_many_empty<explicit_context>(firstIndexInBlock, static_cast<size_t>(endIndex - firstIndexInBlock)); |
| 2337 | indexIndex = (indexIndex + 1) & (localBlockIndex->size - 1); |
| 2338 | |
| 2339 | firstIndexInBlock = index; |
| 2340 | endIndex = (index & ~static_cast<index_t>(BLOCK_SIZE - 1)) + static_cast<index_t>(BLOCK_SIZE); |
| 2341 | endIndex = details::circular_less_than<index_t>(firstIndex + static_cast<index_t>(actualCount), endIndex) ? firstIndex + static_cast<index_t>(actualCount) : endIndex; |
| 2342 | } while (index != firstIndex + actualCount); |
| 2343 | |
| 2344 | MOODYCAMEL_RETHROW; |
| 2345 | } |
| 2346 | } |
| 2347 | block->ConcurrentQueue::Block::template set_many_empty<explicit_context>(firstIndexInBlock, static_cast<size_t>(endIndex - firstIndexInBlock)); |
| 2348 | indexIndex = (indexIndex + 1) & (localBlockIndex->size - 1); |