Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
6.7
Description
In certain scenarios, it's desired to monitor if the other side of a pipe has been closed but we are not interested in reading from it. For example, in kwin, we need that to implement the wp-security-context-v1 protocol.
The closest thing that Qt has to offer is QSocketNotifier::Read. However, it has potential denial of service issues. For example if some data is written, then QSocketNotifier::activated will keep firing every event loop cycle thus the CPU usage will skyrocket. One would also need to add code that drains the pipe, which is not great as it adds more complexity.
It can be simpler if QSocketNotifier provided more fine-grained flags to control which IO conditions should be monitored. For example
- in
- out
- hup
- err
- pri
For what it's worth, most platforms already provide APIs that would match these flags. In order to provide backwards compatibility, QSocketNotifier::Kind can be mapped to the flags.
Alternatively, if it's not a viable option. Is it possible to add APIs to let user code integrate their own socket notifiers into Qt event loops?