| 677 | } |
| 678 | |
| 679 | bool AsyncLocalWriteFile::waitForCompleteAll() { |
| 680 | io_uring_cqe* cqe; |
| 681 | auto pending = pending_.wlock(); |
| 682 | while (*pending > 0) { |
| 683 | int ret = io_uring_wait_cqe(ring_.get(), &cqe); |
| 684 | if (ret < 0) { |
| 685 | LOG(ERROR) << "Failed to wait for CQE with errorno " << -ret << " : " |
| 686 | << std::strerror(-ret); |
| 687 | return false; |
| 688 | } |
| 689 | if (cqe->res < 0) { |
| 690 | LOG(ERROR) << "Failed to get result with errorno " << -(cqe->res) << " : " |
| 691 | << std::strerror(-cqe->res); |
| 692 | return false; |
| 693 | } else { |
| 694 | (*pending)--; |
| 695 | io_uring_cqe_seen(ring_.get(), cqe); |
| 696 | } |
| 697 | } |
| 698 | return true; |
| 699 | } |
| 700 | |
| 701 | void AsyncLocalWriteFile::close() { |
| 702 | if (!closed_) { |