mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-29 13:23:31 +02:00
giomodule: Don’t mandatorily cache GIOModule implementations
While all of the current callers of _g_io_module_get_default() want to cache the returned GObject for the lifetime of the process, that doesn’t necessarily have to be the case, so let callers make that decision on a case-by-case basis. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
committed by
Philip Withnall
parent
b207965697
commit
22b924b64a
@@ -93,6 +93,8 @@ g_tls_backend_default_init (GTlsBackendInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
static GTlsBackend *tls_backend_default_singleton = NULL; /* (owned) (atomic) */
|
||||
|
||||
/**
|
||||
* g_tls_backend_get_default:
|
||||
*
|
||||
@@ -106,8 +108,18 @@ g_tls_backend_default_init (GTlsBackendInterface *iface)
|
||||
GTlsBackend *
|
||||
g_tls_backend_get_default (void)
|
||||
{
|
||||
return _g_io_module_get_default (G_TLS_BACKEND_EXTENSION_POINT_NAME,
|
||||
"GIO_USE_TLS", NULL);
|
||||
if (g_once_init_enter (&tls_backend_default_singleton))
|
||||
{
|
||||
GTlsBackend *singleton;
|
||||
|
||||
singleton = _g_io_module_get_default (G_TLS_BACKEND_EXTENSION_POINT_NAME,
|
||||
"GIO_USE_TLS",
|
||||
NULL);
|
||||
|
||||
g_once_init_leave (&tls_backend_default_singleton, singleton);
|
||||
}
|
||||
|
||||
return tls_backend_default_singleton;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user