summaryrefslogtreecommitdiff
path: root/src/devices/wwan
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-04-23 14:23:23 +0200
committerThomas Haller <thaller@redhat.com>2020-04-24 19:36:53 +0200
commit0119fa8c3d98ef9704051d936d573147eab2610d (patch)
tree3e932ad47b6e037842d89c4cf147df4152daf179 /src/devices/wwan
parent02a31e71afbc1f62dfead8eb08878d10b1efaf95 (diff)
downloadNetworkManager-0119fa8c3d98ef9704051d936d573147eab2610d.tar.gz
shared: add nm_utils_invoke_on_timeout()
Add nm_utils_invoke_on_timeout() beside nm_utils_invoke_on_idle(). They are fundamentally similar, except one schedules an idle handler and the other a timeout. Also, use the current g_main_context_get_thread_default() as context instead of the singleton instance. That is a change in behavior, but the only caller of nm_utils_invoke_on_idle() is the daemon, which doesn't use different main contexts. Anyway, to avoid anybody being tripped up by this also change the order of arguments. It anyway seems nicer to first pass the cancellable, and the callback and user data as last arguments. It's more in line with glib's asynchronous methods. Also, in the unlikely case that the cancellable is already cancelled from the start, always schedule an idle action to complete fast. (cherry picked from commit cd5157a0c38adb20eb290a145888703b3d09dd4f)
Diffstat (limited to 'src/devices/wwan')
-rw-r--r--src/devices/wwan/nm-modem-broadband.c6
-rw-r--r--src/devices/wwan/nm-modem-ofono.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c
index f89ec86c9f..3fdc5ac54b 100644
--- a/src/devices/wwan/nm-modem-broadband.c
+++ b/src/devices/wwan/nm-modem-broadband.c
@@ -1254,9 +1254,9 @@ disconnect (NMModem *modem,
/* Already cancelled or no simple-iface? We are done. */
if ( !ctx->self->_priv.simple_iface
|| g_cancellable_is_cancelled (cancellable)) {
- nm_utils_invoke_on_idle (disconnect_context_complete_on_idle,
- ctx,
- cancellable);
+ nm_utils_invoke_on_idle (cancellable,
+ disconnect_context_complete_on_idle,
+ ctx);
return;
}
diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c
index 2fc44881a9..96b08e7cff 100644
--- a/src/devices/wwan/nm-modem-ofono.c
+++ b/src/devices/wwan/nm-modem-ofono.c
@@ -211,9 +211,9 @@ disconnect (NMModem *modem,
if ( state != NM_MODEM_STATE_CONNECTED
|| g_cancellable_is_cancelled (cancellable)) {
- nm_utils_invoke_on_idle (disconnect_context_complete_on_idle,
- ctx,
- cancellable);
+ nm_utils_invoke_on_idle (cancellable,
+ disconnect_context_complete_on_idle,
+ ctx);
return;
}