[Development] epoll event dispatcher
Thiago Macieira
thiago.macieira at intel.com
Thu Aug 8 18:13:42 CEST 2013
On quinta-feira, 8 de agosto de 2013 17:46:05, Oswald Buddenhagen wrote:
> epoll() perfectly fits the design of an object-oriented notifier
> interface as we have. why does qt code toggle the notifiers so often?
> would it be possible to rewrite it?
Not sure. There is some code that does it because Windows requires toggling,
so it does so in all platforms (because it's cheap, as it doesn't require a
syscall to do so). The code is also based on buffers and how often the user
code empties those buffers. So it will be affected by user code too.
But even if I'm wrong, I'd like to do what you're asking for here:
> would it be possible to optimize it
> behind the scenes (e.g., propagate the toggling to the kernel only upon
> entering the event loop)?
Yes, that would be ideal. That would require iterating over all socket
notifiers we have on this event dispatcher, to determine which ones have
changed since. Then we'd have to do a series of epoll_ctl calls to toggle
before doing our sleep with epoll_wait.
I'd rather not do a flurry of syscalls before epoll_wait. That's wasteful.
Instead, I'd rather have a syscall that sets the file descriptor state and
sleeps in one single syscall.
That's called poll(2).
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130808/310aaec0/attachment.sig>
More information about the Development
mailing list