mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 05:00:15 +01:00
glib-aux: fix thread-safe initialization in _nm_g_source_sentinel_get_init()
Fixes:ce7c28c514('glib-aux: add nm_g_source_sentinel_get() util') (cherry picked from commit2140bbf7f5)
This commit is contained in:
parent
ef3b773bc3
commit
c37f72acd3
1 changed files with 2 additions and 2 deletions
|
|
@ -4935,14 +4935,14 @@ _nm_g_source_sentinel_get_init(GSource **p_source)
|
|||
};
|
||||
GSource *source;
|
||||
|
||||
again:
|
||||
source = g_source_new((GSourceFuncs *) &source_funcs, sizeof(GSource));
|
||||
g_source_set_priority(source, G_PRIORITY_DEFAULT_IDLE);
|
||||
g_source_set_name(source, "nm_g_source_sentinel");
|
||||
|
||||
if (!g_atomic_pointer_compare_and_exchange(p_source, NULL, source)) {
|
||||
g_source_unref(source);
|
||||
goto again;
|
||||
source = g_atomic_pointer_get(p_source);
|
||||
nm_assert(source);
|
||||
}
|
||||
|
||||
return source;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue