* Internal helper function to wait for AIO completion. */
| 316 | * Internal helper function to wait for AIO completion. |
| 317 | */ |
| 318 | void |
| 319 | RuntimeLogger::waitForAIO() { |
| 320 | if (hasOutstandingOperation) { |
| 321 | if (aio_error(&aioCb) == EINPROGRESS) { |
| 322 | const struct aiocb *const aiocb_list[] = {&aioCb}; |
| 323 | int err = aio_suspend(aiocb_list, 1, NULL); |
| 324 | |
| 325 | if (err != 0) |
| 326 | perror("LogCompressor's Posix AIO suspend operation failed"); |
| 327 | } |
| 328 | |
| 329 | int err = aio_error(&aioCb); |
| 330 | ssize_t ret = aio_return(&aioCb); |
| 331 | |
| 332 | if (err != 0) { |
| 333 | fprintf(stderr, "LogCompressor's POSIX AIO failed with %d: %s\r\n", |
| 334 | err, strerror(err)); |
| 335 | } else if (ret < 0) { |
| 336 | perror("LogCompressor's Posix AIO Write operation failed"); |
| 337 | } |
| 338 | ++numAioWritesCompleted; |
| 339 | hasOutstandingOperation = false; |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * Main compression thread that handles scanning through the StagingBuffers, |
nothing calls this directly
no outgoing calls
no test coverage detected