mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 16:30:31 +01:00
Add a fire-and-forget function to wait for shutdown to be complete.
It's not entirely trivial to ensure all resources of NMClient are
cleaned up. That matters only if NMClient uses a temporary GMainContext
that the user wants to release while the application continues. For
example, to do some short-lived operations an a worker thread. It's
not trivial also because glib provides no convenient API to integrate
a GMainContext in another GMainContext. We have that code as
nm_utils_g_main_context_create_integrate_source(), so add a helper
function to allow the user to do this.
The function allows to omit the callback, in which case the caller
wouldn't know when shutdown is complete. That would still be useful
however, when integrating the client's context into the caller's
context, so that the client's context gets automatically iterated
until completion.
The following test script will run out of file descriptors,
when wait_shutdown() is not used:
#!/bin/python
import gi
gi.require_version("NM", "1.0")
from gi.repository import NM, GLib
for i in range(1200):
print(f">>>{i}")
ctx = GLib.MainContext()
ctx.push_thread_default()
nmc = NM.Client.new()
ctx.pop_thread_default()
def cb(unused, result, i):
try:
NM.Client.wait_shutdown_finish(result)
except Exception:
# cannot happen
assert False
else:
print(f">>>>> {i} complete")
nmc.wait_shutdown(True, None, cb, i)
while GLib.MainContext.default().iteration(False):
pass
|
||
|---|---|---|
| .. | ||
| meson.build | ||
| NetworkManager.h | ||
| nm-access-point.h | ||
| nm-active-connection.h | ||
| nm-autoptr.h | ||
| nm-checkpoint.h | ||
| nm-client.h | ||
| nm-conn-utils.h | ||
| nm-device-6lowpan.h | ||
| nm-device-adsl.h | ||
| nm-device-bond.h | ||
| nm-device-bridge.h | ||
| nm-device-bt.h | ||
| nm-device-dummy.h | ||
| nm-device-ethernet.h | ||
| nm-device-generic.h | ||
| nm-device-infiniband.h | ||
| nm-device-ip-tunnel.h | ||
| nm-device-macsec.h | ||
| nm-device-macvlan.h | ||
| nm-device-modem.h | ||
| nm-device-olpc-mesh.h | ||
| nm-device-ovs-bridge.h | ||
| nm-device-ovs-interface.h | ||
| nm-device-ovs-port.h | ||
| nm-device-ppp.h | ||
| nm-device-team.h | ||
| nm-device-tun.h | ||
| nm-device-veth.h | ||
| nm-device-vlan.h | ||
| nm-device-vrf.h | ||
| nm-device-vxlan.h | ||
| nm-device-wifi-p2p.h | ||
| nm-device-wifi.h | ||
| nm-device-wimax.h | ||
| nm-device-wireguard.h | ||
| nm-device-wpan.h | ||
| nm-device.h | ||
| nm-dhcp-config.h | ||
| nm-enum-types.c.template | ||
| nm-enum-types.h.template | ||
| nm-ethtool-utils.h | ||
| nm-ip-config.h | ||
| nm-object.h | ||
| nm-remote-connection.h | ||
| nm-secret-agent-old.h | ||
| nm-vpn-connection.h | ||
| nm-vpn-editor.h | ||
| nm-vpn-plugin-old.h | ||
| nm-vpn-service-plugin.h | ||
| nm-wifi-p2p-peer.h | ||
| nm-wimax-nsp.h | ||
| README.md | ||
libnm-client-public
libnm is NetworkManager's client API. It has a public API. This API consists of two parts:
- the handling of connections (
NMConnection), implemented by libnm-core-impl. - the caching of D-Bus API (
NMClient), implemented by libnm-client-impl.
This directory contains public headers that are used by libnm
users. As such, it's the NMClient part of libnm-core-public.
These headers are usable to any libnm client application and to libnm itself. But not to libnm-core-impl or the daemon.