diff options
author | Thomas Haller <thaller@redhat.com> | 2019-11-02 16:55:43 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-11-25 12:58:33 +0100 |
commit | 4fad8c7c642e20d17f0129dbae24c898ba5afc90 (patch) | |
tree | e86814841911909c4322284003755afb08333d26 /libnm/tests | |
parent | 45c9f3c39bf3292c000ef0bdbcfa6d84e16b5ca0 (diff) | |
download | NetworkManager-4fad8c7c642e20d17f0129dbae24c898ba5afc90.tar.gz |
shared: add nm_utils_g_main_context_create_integrate_source() for integrating a GMainContext in another
We will rework NMClient entirely. Then, the synchronous initialization will also use
the asynchronous code paths. The difference will be that with synchronous initialization,
all D-Bus interaction will be done with an internal GMainContext as current thread default,
and that internal context will run until initialization completes.
Note that even after initialization completes, it cannot be swapped back to the user's
(outer) GMainContext. That is because contexts are essentially the queue for our
D-Bus events, and we cannot swap from one queue to the other in a race
free manner (or a full resync). In other words, the two contexts are not in sync,
so after using the internal context NMClient needs to stick to that (at least, until
the name owner gets lost, which gives an opportunity to resync and switch back to the
user's main context).
We thus need to hook the internal (inner) GMainContext with the user's (outer) context,
so when the user iterates the outer context, events on the inner context get dispatched.
Add nm_utils_g_main_context_create_integrate_source() to create such a GSource for
integrating two contexts.
Note that the use-case here is limited: the integrated, inner main context must
not be explicitly iterated except from being dispatched by the integrating
source. Otherwise, you'd get recursive runs, possible deadlocks and general
ugliness. NMClient must show restrain how to use the inner context while it is
integrated.
Diffstat (limited to 'libnm/tests')
0 files changed, 0 insertions, 0 deletions