MySQL 8.0 C API Developer Guide  /  C API Asynchronous Interface

Chapter 7 C API Asynchronous Interface

As of MySQL 8.0.16, the C API includes asynchronous functions that enable nonblocking communication with the MySQL server. Asynchronous functions enable development of applications that differ from the query processing model based on synchronous functions that block if reads from or writes to the server connection must wait. Using the asynchronous functions, an application can check whether work on the server connection is ready to proceed. If not, the application can perform other work before checking again later.

For example, an application might open multiple connections to the server and use them to submit multiple statements for execution. The application then can poll the connections to see which of them have results to be fetched, while doing other work.

Note

As just indicated, execution of multiple simultaneous statements should be done using multiple connections and executing one statement per connection. The asynchronous interface is not intended for executing multiple simultaneous statements per connection. What it enables is that applications can do other work rather than waiting for server operations to complete.