Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Intel's C++ Asynchronous I/O Library for Windows

Intel's C/C++ asynchronous I/O (AIO) library implementation for Windows is similar to the POSIX AIO library implementation for Linux.

The differences between Intel's C/C++ AIO Windows OS implementation and the standard POSIX AIO implementation are listed below:

  • In struct aiocb,
    • The Windows OS compatible type HANDLE replaces the POSIX AIO type unsigned int for the file descriptor aio_fildes.
    • The type intptr_t replaces the POSIX AIO types ssize_t and __off_t.

  • The structure specifying the signal event descriptor, struct sigevent is similar to the Linux operating system implementation of the POSIX AIO library. It differs from the Linux implementation in the following ways:
    • Signal notification and non-notification for thread call-back is supported
    • Signal notification on completion of the AIO operation is not supported

      This is true for programs that were already written for Linux/Unix and ported to Windows OS that wish to setup an AIO completion handler without the name of the handler set in the aiocb struct. Because of the way that signals are supported in Windows, this is impossible to implement. For new applications, or to port existing applications, the programmer should set the name of the handler before calling the aio_read or aio_write routines. For example:

      static void aio_CompletionRoutine(sigval_t sigval)
      {
          // … code …
      }
      
      … code …
      
      my_aio.aio_sigevent.sigev_notify          = SIGEV_THREAD;
      my_aio.aio_sigevent.sigev_notify_function = aio_CompletionRoutine;
      

NOTE:

The POSIX AIO library and the Microsoft SDK provide similar AIO functions. The main difference between the POSIX AIO functions and the Windows operating system-based AIO functions is that while POSIX allows you to execute AIO operations with any file, the Windows operating system executes AIO operations only with files flagged with FILE_FLAG_OVERLAPPED.

Intel's asynchronous I/O library functions listed below are all based on POSIX AIO functions. They are defined in the aio.h file.