Вопрос

I'm following this example to get notifications from the kernel for close events.

I wanted to add a small delay to the end of the while(1) loop to reduce the CPU usage. Will there be a chance to miss events, or will the kernel add the events not read by the program in the next iteration?

Это было полезно?

Решение

You should not need to and, in fact, absolutely should not, introduce any extra latency into the notification loop. CPU use should not be that high because the 'read( fd, buffer, BUF_LEN )' call should block until something of interest happens.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top