Linux asynchronous notification-Linux general technology-Linux programming and kernel information. The following is a detailed description. The combination of blocking and non-blocking access and poll functions can better solve the reading and writing of devices, but it is more convenient if asynchronous notifications are provided. Asynchronous notification means that once the device is ready, the application is actively notified so that the application does not need to query the device status at all. This is very similar to the concept of "interruption" on hardware, the more accurate title is "SIGIO asynchronous I/O ".
Let's take a look at a signal-driven example. It uses signal (SIGIO, input_handler) to start the signal mechanism for STDIN_FILENO. When the input is available, input_handler is called. The source code is as follows: