Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-119041

QSocketNotifier provides no way to monitor just POLLHUP

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.7
    • Core: Event loop

    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?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            zzag Vlad Zahorodnii
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes