summaryrefslogtreecommitdiff
path: root/src/platform/nm-linux-platform.c
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/platform/nm-linux-platform.c
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/platform/nm-linux-platform.c')
-rw-r--r--src/platform/nm-linux-platform.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index f7249bb71e..014cca71da 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -5131,9 +5131,9 @@ sysctl_set_async (NMPlatform *platform,
callback,
data,
error);
- nm_utils_invoke_on_idle (sysctl_set_async_return_idle,
- packed,
- cancellable);
+ nm_utils_invoke_on_idle (cancellable,
+ sysctl_set_async_return_idle,
+ packed);
return;
}
} else
@@ -7390,7 +7390,7 @@ out_idle:
g_steal_pointer (&error),
callback,
data);
- nm_utils_invoke_on_idle (sriov_idle_cb, packed, cancellable);
+ nm_utils_invoke_on_idle (cancellable, sriov_idle_cb, packed);
}
}