mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 03:10:10 +01:00
glib-aux: add nm_g_unix_fd_add_source() helper
This commit is contained in:
parent
70e5d8e5bd
commit
34f48a33f3
1 changed files with 14 additions and 0 deletions
|
|
@ -1770,6 +1770,20 @@ nm_g_timeout_add_source_approx(guint timeout_msec,
|
|||
return nm_g_source_attach(source, NULL);
|
||||
}
|
||||
|
||||
static inline GSource *
|
||||
nm_g_unix_fd_add_source(int fd,
|
||||
GIOCondition condition,
|
||||
GUnixFDSourceFunc function,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* A convenience function to attach a new unix-fd source to the default GMainContext.
|
||||
* In that sense it's very similar to g_unix_fd_add() except that it returns a
|
||||
* reference to the new source. */
|
||||
return nm_g_source_attach(
|
||||
nm_g_unix_fd_source_new(fd, condition, G_PRIORITY_DEFAULT, function, user_data, NULL),
|
||||
NULL);
|
||||
}
|
||||
|
||||
NM_AUTO_DEFINE_FCN0(GMainContext *, _nm_auto_unref_gmaincontext, g_main_context_unref);
|
||||
#define nm_auto_unref_gmaincontext nm_auto(_nm_auto_unref_gmaincontext)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue