MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / waitForAIO

Method waitForAIO

runtime/RuntimeLogger.cc:318–341  ·  view source on GitHub ↗

* Internal helper function to wait for AIO completion. */

Source from the content-addressed store, hash-verified

316* Internal helper function to wait for AIO completion.
317*/
318void
319RuntimeLogger::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,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected