GNOME Bugzilla – Bug 741716
add simple polling helpers for GCancellable
Last modified: 2018-05-24 17:21:09 UTC
See patches.
Created attachment 292980 [details] [review] GCancellable: add new poll wrapper APIs Add two APIs to GCancellable for waiting on one or more GPollFD records until they are ready, or until cancellation. This is basically a cancellable version of g_poll(). This makes many typical operations easier; it will be possible to replace all cases of g_cancellable_make_pollfd() in GIO with just the simple version of this function, often at a large reduction in lines of code. Even better is that in the future, users of this API may be able to avoid allocating an fd at all. I'm not sure if it's worth keeping the _full version.
Created attachment 292981 [details] [review] gio: use new g_cancellable_poll_simple() API This removes a lot of similar-looking code. This also means that there is no longer any code inside of GIO that is handling fds from GCancellable. That moves us closer to being able to completely rid ourselves of per-cancellable file descriptors. Windows parts are completely untested (and not even compiled).
(In reply to comment #1) > I'm not sure if it's worth keeping the _full version. I'd actually just keep that one since at that point is exactly the same signature as g_poll plus the cancellable. Also I'd maybe simply call it g_poll_full or g_poll_cancellable (with cancellable being the last param), so that it is in the "g_poll namespace" and not in the "g_cancellable namespace"
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/975.