| 325 | ARROW_DISALLOW_COPY_AND_ASSIGN(SerialIterator); |
| 326 | ARROW_DEFAULT_MOVE_AND_ASSIGN(SerialIterator); |
| 327 | ~SerialIterator() { |
| 328 | // A serial iterator must be consumed before it can be destroyed. Allowing it to |
| 329 | // do otherwise would lead to resource leakage. There will likely be deadlocks at |
| 330 | // this spot in the future but these will be the result of other bugs and not the |
| 331 | // fact that we are forcing consumption here. |
| 332 | |
| 333 | // If a streaming API needs to support early abandonment then it should be done so |
| 334 | // with a cancellation token and not simply discarding the iterator and expecting |
| 335 | // the underlying work to clean up correctly. |
| 336 | if (executor && !executor->IsFinished()) { |
| 337 | while (true) { |
| 338 | Result<T> maybe_next = Next(); |
| 339 | if (!maybe_next.ok() || IsIterationEnd(*maybe_next)) { |
| 340 | break; |
| 341 | } |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | Result<T> Next() { |
| 347 | executor->Unpause(); |
nothing calls this directly
no test coverage detected