gsource: Add support for file descriptors on UNIX

Adding file descriptors to a GSource provides similar functionality to
the old g_source_add_poll() API with two main differences.

First: the list of handles is managed internally and therefore users are
prevented from randomly modifying the ->events field.  This prepares us
for an epoll future where changing the event mask is a syscall.

Second: keeping the list internally allows us to check the ->revents for
events for ourselves, allowing the source to skip implementing
check/prepare.  This also prepares us for the future by allowing an
implementation that doesn't need to iterate over all of the sources
every time.

https://bugzilla.gnome.org/show_bug.cgi?id=686853
This commit is contained in:
Ryan Lortie
2013-01-14 16:53:06 -05:00
parent db7d5306cc
commit cbf68cb22d
4 changed files with 246 additions and 4 deletions

View File

@@ -530,6 +530,10 @@ GSourceFunc
g_source_set_callback_indirect
g_source_set_ready_time
g_source_get_ready_time
g_source_add_unix_fd
g_source_remove_unix_fd
g_source_modify_unix_fd
g_source_query_unix_fd
g_source_add_poll
g_source_remove_poll
g_source_add_child_source