mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 20:40:34 +01:00
all: merge branch 'th/gsource-attach'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1141
This commit is contained in:
commit
256a4cb5d6
13 changed files with 40 additions and 59 deletions
|
|
@ -748,12 +748,8 @@ _ipv4ll_set_timed_out_update(NML3IPv4LL *self, TimedOutState new_state)
|
|||
if (self->timed_out_expiry_msec == 0 || self->timed_out_expiry_msec < expiry_msec) {
|
||||
self->timed_out_expiry_msec = expiry_msec;
|
||||
nm_clear_g_source_inst(&self->timed_out_source);
|
||||
self->timed_out_source = nm_g_timeout_source_new(timeout_msec,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_ipv4ll_set_timed_out_timeout_cb,
|
||||
self,
|
||||
NULL);
|
||||
g_source_attach(self->timed_out_source, NULL);
|
||||
self->timed_out_source =
|
||||
nm_g_timeout_add_source(timeout_msec, _ipv4ll_set_timed_out_timeout_cb, self);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -922,8 +918,7 @@ _ipv4ll_state_change_on_idle(NML3IPv4LL *self)
|
|||
|
||||
if (!self->state_change_on_idle_source) {
|
||||
self->state_change_on_idle_source =
|
||||
nm_g_idle_source_new(G_PRIORITY_DEFAULT, _ipv4ll_state_change_on_idle_cb, self, NULL);
|
||||
g_source_attach(self->state_change_on_idle_source, NULL);
|
||||
nm_g_idle_add_source(_ipv4ll_state_change_on_idle_cb, self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1743,9 +1743,7 @@ again:
|
|||
|
||||
n_acd_get_fd(self->priv.p->nacd, &fd);
|
||||
|
||||
self->priv.p->nacd_source =
|
||||
nm_g_unix_fd_source_new(fd, G_IO_IN, G_PRIORITY_DEFAULT, _l3_acd_nacd_event, self, NULL);
|
||||
nm_g_source_attach(self->priv.p->nacd_source, NULL);
|
||||
self->priv.p->nacd_source = nm_g_unix_fd_add_source(fd, G_IO_IN, _l3_acd_nacd_event, self);
|
||||
|
||||
NM_SET_OUT(out_acd_not_supported, FALSE);
|
||||
return self->priv.p->nacd;
|
||||
|
|
|
|||
|
|
@ -114,13 +114,10 @@ st_sd_init(NMSessionMonitor *monitor)
|
|||
return;
|
||||
}
|
||||
|
||||
monitor->sd.watch = nm_g_unix_fd_source_new(sd_login_monitor_get_fd(monitor->sd.monitor),
|
||||
monitor->sd.watch = nm_g_unix_fd_add_source(sd_login_monitor_get_fd(monitor->sd.monitor),
|
||||
G_IO_IN,
|
||||
G_PRIORITY_DEFAULT,
|
||||
st_sd_changed,
|
||||
monitor,
|
||||
NULL);
|
||||
g_source_attach(monitor->sd.watch, NULL);
|
||||
monitor);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -2778,13 +2778,7 @@ nmtstp_acd_defender_new(int ifindex, in_addr_t ip_addr, const NMEtherAddr *mac_a
|
|||
n_acd_get_fd(defender->nacd, &fd);
|
||||
g_assert_cmpint(fd, >=, 0);
|
||||
|
||||
defender->source = nm_g_source_attach(nm_g_unix_fd_source_new(fd,
|
||||
G_IO_IN,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_l3_acd_nacd_event,
|
||||
defender,
|
||||
NULL),
|
||||
NULL);
|
||||
defender->source = nm_g_unix_fd_add_source(fd, G_IO_IN, _l3_acd_nacd_event, defender);
|
||||
|
||||
return defender;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7349,7 +7349,10 @@ _init_start_with_bus(NMClient *self)
|
|||
NULL);
|
||||
if (id == 0) {
|
||||
priv->init_data->cancel_on_idle_source =
|
||||
nm_g_idle_source_new(G_PRIORITY_DEFAULT, _init_start_cancel_on_idle_cb, self, NULL);
|
||||
nm_g_idle_source_new(G_PRIORITY_DEFAULT_IDLE,
|
||||
_init_start_cancel_on_idle_cb,
|
||||
self,
|
||||
NULL);
|
||||
g_source_attach(priv->init_data->cancel_on_idle_source, priv->main_context);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4691,14 +4691,20 @@ _nm_utils_invoke_on_idle_start(gboolean use_timeout,
|
|||
}
|
||||
|
||||
if (use_timeout) {
|
||||
/* We use G_PRIORITY_DEFAULT_IDLE both for the with/without timeout
|
||||
* case. The reason is not strong, but it seems right that the caller
|
||||
* requests a lower priority than G_PRIORITY_DEFAULT. That is unlike
|
||||
* what g_timeout_add() would do. */
|
||||
source = nm_g_timeout_source_new(timeout_msec,
|
||||
G_PRIORITY_DEFAULT,
|
||||
G_PRIORITY_DEFAULT_IDLE,
|
||||
_nm_utils_invoke_on_idle_cb_idle,
|
||||
data,
|
||||
NULL);
|
||||
} else {
|
||||
source =
|
||||
nm_g_idle_source_new(G_PRIORITY_DEFAULT, _nm_utils_invoke_on_idle_cb_idle, data, NULL);
|
||||
source = nm_g_idle_source_new(G_PRIORITY_DEFAULT_IDLE,
|
||||
_nm_utils_invoke_on_idle_cb_idle,
|
||||
data,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* use the current thread default context. */
|
||||
|
|
|
|||
|
|
@ -1789,7 +1789,7 @@ nm_g_idle_add_source(GSourceFunc func, gpointer user_data)
|
|||
/* A convenience function to attach a new timeout source to the default GMainContext.
|
||||
* In that sense it's very similar to g_idle_add() except that it returns a
|
||||
* reference to the new source. */
|
||||
return nm_g_source_attach(nm_g_idle_source_new(G_PRIORITY_DEFAULT, func, user_data, NULL),
|
||||
return nm_g_source_attach(nm_g_idle_source_new(G_PRIORITY_DEFAULT_IDLE, func, user_data, NULL),
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9759,13 +9759,10 @@ constructed(GObject *_object)
|
|||
fd);
|
||||
|
||||
priv->event_source =
|
||||
nm_g_unix_fd_source_new(fd,
|
||||
nm_g_unix_fd_add_source(fd,
|
||||
G_IO_IN | G_IO_NVAL | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
G_PRIORITY_DEFAULT,
|
||||
event_handler,
|
||||
platform,
|
||||
NULL);
|
||||
g_source_attach(priv->event_source, NULL);
|
||||
platform);
|
||||
|
||||
/* complete construction of the GObject instance before populating the cache. */
|
||||
G_OBJECT_CLASS(nm_linux_platform_parent_class)->constructed(_object);
|
||||
|
|
|
|||
|
|
@ -625,12 +625,7 @@ main(int argc, const char *const *argv)
|
|||
|
||||
sigterm_cancellable = g_cancellable_new();
|
||||
|
||||
sigterm_source = nm_g_source_attach(nm_g_unix_signal_source_new(SIGTERM,
|
||||
G_PRIORITY_DEFAULT,
|
||||
sigterm_handler,
|
||||
sigterm_cancellable,
|
||||
NULL),
|
||||
NULL);
|
||||
sigterm_source = nm_g_unix_signal_add_source(SIGTERM, sigterm_handler, sigterm_cancellable);
|
||||
|
||||
provider = _provider_detect(sigterm_cancellable);
|
||||
if (!provider)
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ nmcs_wait_for_objects_iterate_until_done(GMainContext *context, int timeout_msec
|
|||
nm_auto_destroy_and_unref_gsource GSource *idle_source = NULL;
|
||||
|
||||
idle_source =
|
||||
nm_g_source_attach(nm_g_idle_source_new(G_PRIORITY_DEFAULT,
|
||||
nm_g_source_attach(nm_g_idle_source_new(G_PRIORITY_DEFAULT_IDLE,
|
||||
_wait_for_objects_iterate_until_done_idle_cb,
|
||||
&data,
|
||||
NULL),
|
||||
|
|
@ -364,7 +364,7 @@ nmcs_utils_poll(int poll_timeout_ms,
|
|||
}
|
||||
|
||||
poll_task_data->source_next_poll = nm_g_source_attach(
|
||||
nm_g_idle_source_new(G_PRIORITY_DEFAULT, _poll_start_cb, poll_task_data, NULL),
|
||||
nm_g_idle_source_new(G_PRIORITY_DEFAULT_IDLE, _poll_start_cb, poll_task_data, NULL),
|
||||
poll_task_data->context);
|
||||
|
||||
if (cancellable) {
|
||||
|
|
|
|||
|
|
@ -680,14 +680,13 @@ _mhandle_socketfunction_cb(CURL *e_handle,
|
|||
condition = 0;
|
||||
|
||||
if (condition) {
|
||||
source_socket = nm_g_unix_fd_source_new(fd,
|
||||
condition,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_mhandle_socket_cb,
|
||||
self,
|
||||
NULL);
|
||||
g_source_attach(source_socket, priv->context);
|
||||
|
||||
source_socket = _source_attach(self,
|
||||
nm_g_unix_fd_source_new(fd,
|
||||
condition,
|
||||
G_PRIORITY_DEFAULT,
|
||||
_mhandle_socket_cb,
|
||||
self,
|
||||
NULL));
|
||||
g_hash_table_insert(priv->source_sockets_hashtable, GINT_TO_POINTER(fd), source_socket);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -889,13 +889,7 @@ nmc_readline_helper(const NmcConfig *nmc_config, const char *prompt)
|
|||
|
||||
nmc_set_in_readline(TRUE);
|
||||
|
||||
io_source = nm_g_unix_fd_source_new(STDIN_FILENO,
|
||||
G_IO_IN,
|
||||
G_PRIORITY_DEFAULT,
|
||||
stdin_ready_cb,
|
||||
NULL,
|
||||
NULL);
|
||||
g_source_attach(io_source, NULL);
|
||||
io_source = nm_g_unix_fd_add_source(STDIN_FILENO, G_IO_IN, stdin_ready_cb, NULL);
|
||||
|
||||
read_again:
|
||||
rl_string = NULL;
|
||||
|
|
|
|||
|
|
@ -8280,9 +8280,12 @@ editor_menu_main(NmCli *nmc, NMConnection *connection, const char *connection_ty
|
|||
connection_changed = FALSE;
|
||||
}
|
||||
|
||||
source = g_timeout_source_new(10 * NM_UTILS_MSEC_PER_SEC);
|
||||
g_source_set_callback(source, editor_save_timeout, &timeout, NULL);
|
||||
g_source_attach(source, g_main_loop_get_context(loop));
|
||||
source = nm_g_source_attach(nm_g_timeout_source_new(10 * NM_UTILS_MSEC_PER_SEC,
|
||||
G_PRIORITY_DEFAULT,
|
||||
editor_save_timeout,
|
||||
&timeout,
|
||||
NULL),
|
||||
g_main_loop_get_context(loop));
|
||||
|
||||
while (!nmc_editor_cb_called && !timeout)
|
||||
g_main_context_iteration(NULL, TRUE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue