mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 09:04:55 +00:00
2008-04-08 Dan Williams <dcbw@redhat.com>
* libnm-glib/nm-object-cache.c libnm-glib/nm-settings.c src/dhcp-manager/nm-dhcp-manager.c system-settings/plugins/ifcfg-fedora/plugin.c system-settings/plugins/ifcfg-suse/plugin.c system-settings/src/nm-system-config-hal-manager.c libnm-util/nm-utils.c - Remove usage of GStaticMutex since gcc-4.3 hates it and because we're not threadsafe anyway git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3548 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
48ef109007
commit
9a49506152
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2008-04-08 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* libnm-glib/nm-object-cache.c
|
||||||
|
libnm-glib/nm-settings.c
|
||||||
|
src/dhcp-manager/nm-dhcp-manager.c
|
||||||
|
system-settings/plugins/ifcfg-fedora/plugin.c
|
||||||
|
system-settings/plugins/ifcfg-suse/plugin.c
|
||||||
|
system-settings/src/nm-system-config-hal-manager.c
|
||||||
|
libnm-util/nm-utils.c
|
||||||
|
- Remove usage of GStaticMutex since gcc-4.3 hates it and because we're
|
||||||
|
not threadsafe anyway
|
||||||
|
|
||||||
2008-04-08 Dan Williams <dcbw@redhat.com>
|
2008-04-08 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* system-settings/src/main.c
|
* system-settings/src/main.c
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "nm-object-cache.h"
|
#include "nm-object-cache.h"
|
||||||
#include "nm-object.h"
|
#include "nm-object.h"
|
||||||
|
|
||||||
static GStaticMutex cache_mutex = G_STATIC_MUTEX_INIT;
|
|
||||||
static GHashTable *cache = NULL;
|
static GHashTable *cache = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -38,19 +37,15 @@ _init_cache (void)
|
||||||
void
|
void
|
||||||
nm_object_cache_remove_by_path (const char *path)
|
nm_object_cache_remove_by_path (const char *path)
|
||||||
{
|
{
|
||||||
g_static_mutex_lock (&cache_mutex);
|
|
||||||
_init_cache ();
|
_init_cache ();
|
||||||
g_hash_table_remove (cache, path);
|
g_hash_table_remove (cache, path);
|
||||||
g_static_mutex_unlock (&cache_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nm_object_cache_remove_by_object (NMObject *object)
|
nm_object_cache_remove_by_object (NMObject *object)
|
||||||
{
|
{
|
||||||
g_static_mutex_lock (&cache_mutex);
|
|
||||||
_init_cache ();
|
_init_cache ();
|
||||||
g_hash_table_remove (cache, nm_object_get_path (object));
|
g_hash_table_remove (cache, nm_object_get_path (object));
|
||||||
g_static_mutex_unlock (&cache_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -58,13 +53,11 @@ nm_object_cache_add (NMObject *object)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
g_static_mutex_lock (&cache_mutex);
|
|
||||||
_init_cache ();
|
_init_cache ();
|
||||||
path = g_strdup (nm_object_get_path (object));
|
path = g_strdup (nm_object_get_path (object));
|
||||||
g_hash_table_insert (cache, path, object);
|
g_hash_table_insert (cache, path, object);
|
||||||
g_object_set_data_full (G_OBJECT (object), "nm-object-cache-tag",
|
g_object_set_data_full (G_OBJECT (object), "nm-object-cache-tag",
|
||||||
path, (GDestroyNotify) nm_object_cache_remove_by_path);
|
path, (GDestroyNotify) nm_object_cache_remove_by_path);
|
||||||
g_static_mutex_unlock (&cache_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NMObject *
|
NMObject *
|
||||||
|
@ -72,10 +65,8 @@ nm_object_cache_get (const char *path)
|
||||||
{
|
{
|
||||||
NMObject *object;
|
NMObject *object;
|
||||||
|
|
||||||
g_static_mutex_lock (&cache_mutex);
|
|
||||||
_init_cache ();
|
_init_cache ();
|
||||||
object = g_hash_table_lookup (cache, path);
|
object = g_hash_table_lookup (cache, path);
|
||||||
g_static_mutex_unlock (&cache_mutex);
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,6 @@ nm_exported_connection_register_object (NMExportedConnection *connection,
|
||||||
DBusGConnection *dbus_connection)
|
DBusGConnection *dbus_connection)
|
||||||
{
|
{
|
||||||
NMExportedConnectionPrivate *priv;
|
NMExportedConnectionPrivate *priv;
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
|
||||||
static guint32 ec_counter = 0;
|
static guint32 ec_counter = 0;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
|
@ -359,10 +358,7 @@ nm_exported_connection_register_object (NMExportedConnection *connection,
|
||||||
|
|
||||||
priv = NM_EXPORTED_CONNECTION_GET_PRIVATE (connection);
|
priv = NM_EXPORTED_CONNECTION_GET_PRIVATE (connection);
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
|
||||||
path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++);
|
path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++);
|
||||||
g_static_mutex_unlock (&mutex);
|
|
||||||
|
|
||||||
nm_connection_set_path (priv->wrapped, path);
|
nm_connection_set_path (priv->wrapped, path);
|
||||||
nm_connection_set_scope (priv->wrapped, scope);
|
nm_connection_set_scope (priv->wrapped, scope);
|
||||||
|
|
||||||
|
|
|
@ -124,33 +124,29 @@ static GHashTable * langToEncodings2 = NULL;
|
||||||
static void
|
static void
|
||||||
init_lang_to_encodings_hash (void)
|
init_lang_to_encodings_hash (void)
|
||||||
{
|
{
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
struct IsoLangToEncodings *enc;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
|
||||||
if (G_UNLIKELY (!langToEncodings5 || !langToEncodings2))
|
|
||||||
{
|
|
||||||
const struct IsoLangToEncodings * enc = &isoLangEntries5[0];
|
|
||||||
|
|
||||||
|
if (G_UNLIKELY (langToEncodings5 == NULL)) {
|
||||||
/* Five-letter codes */
|
/* Five-letter codes */
|
||||||
|
enc = (struct IsoLangToEncodings *) &isoLangEntries5[0];
|
||||||
langToEncodings5 = g_hash_table_new (g_str_hash, g_str_equal);
|
langToEncodings5 = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
while (enc->lang)
|
while (enc->lang) {
|
||||||
{
|
|
||||||
g_hash_table_insert (langToEncodings5, (gpointer) enc->lang,
|
g_hash_table_insert (langToEncodings5, (gpointer) enc->lang,
|
||||||
(gpointer) &enc->encodings);
|
(gpointer) &enc->encodings);
|
||||||
enc++;
|
enc++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (langToEncodings2 == NULL)) {
|
||||||
/* Two-letter codes */
|
/* Two-letter codes */
|
||||||
enc = &isoLangEntries2[0];
|
enc = (struct IsoLangToEncodings *) &isoLangEntries2[0];
|
||||||
langToEncodings2 = g_hash_table_new (g_str_hash, g_str_equal);
|
langToEncodings2 = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
while (enc->lang)
|
while (enc->lang) {
|
||||||
{
|
|
||||||
g_hash_table_insert (langToEncodings2, (gpointer) enc->lang,
|
g_hash_table_insert (langToEncodings2, (gpointer) enc->lang,
|
||||||
(gpointer) &enc->encodings);
|
(gpointer) &enc->encodings);
|
||||||
enc++;
|
enc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_static_mutex_unlock (&mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,14 +121,11 @@ get_leasefile_for_iface (const char * iface)
|
||||||
NMDHCPManager *
|
NMDHCPManager *
|
||||||
nm_dhcp_manager_get (void)
|
nm_dhcp_manager_get (void)
|
||||||
{
|
{
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
|
||||||
static NMDHCPManager *singleton = NULL;
|
static NMDHCPManager *singleton = NULL;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
|
||||||
if (!singleton)
|
if (!singleton)
|
||||||
singleton = nm_dhcp_manager_new ();
|
singleton = nm_dhcp_manager_new ();
|
||||||
g_object_ref (singleton);
|
g_object_ref (singleton);
|
||||||
g_static_mutex_unlock (&mutex);
|
|
||||||
|
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,14 +989,12 @@ system_config_interface_init (NMSystemConfigInterface *system_config_interface_c
|
||||||
G_MODULE_EXPORT GObject *
|
G_MODULE_EXPORT GObject *
|
||||||
nm_system_config_factory (void)
|
nm_system_config_factory (void)
|
||||||
{
|
{
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
|
||||||
static SCPluginIfcfg *singleton = NULL;
|
static SCPluginIfcfg *singleton = NULL;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
|
||||||
if (!singleton)
|
if (!singleton)
|
||||||
singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL));
|
singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL));
|
||||||
g_object_ref (singleton);
|
else
|
||||||
g_static_mutex_unlock (&mutex);
|
g_object_ref (singleton);
|
||||||
|
|
||||||
return G_OBJECT (singleton);
|
return G_OBJECT (singleton);
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,14 +425,12 @@ system_config_interface_init (NMSystemConfigInterface *system_config_interface_c
|
||||||
G_MODULE_EXPORT GObject *
|
G_MODULE_EXPORT GObject *
|
||||||
nm_system_config_factory (void)
|
nm_system_config_factory (void)
|
||||||
{
|
{
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
|
||||||
static SCPluginIfcfg *singleton = NULL;
|
static SCPluginIfcfg *singleton = NULL;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
|
||||||
if (!singleton)
|
if (!singleton)
|
||||||
singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL));
|
singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL));
|
||||||
g_object_ref (singleton);
|
else
|
||||||
g_static_mutex_unlock (&mutex);
|
g_object_ref (singleton);
|
||||||
|
|
||||||
return G_OBJECT (singleton);
|
return G_OBJECT (singleton);
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,15 +260,12 @@ nm_system_config_hal_manager_new (DBusGConnection *g_connection)
|
||||||
NMSystemConfigHalManager *
|
NMSystemConfigHalManager *
|
||||||
nm_system_config_hal_manager_get (DBusGConnection *g_connection)
|
nm_system_config_hal_manager_get (DBusGConnection *g_connection)
|
||||||
{
|
{
|
||||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
|
||||||
static NMSystemConfigHalManager *singleton = NULL;
|
static NMSystemConfigHalManager *singleton = NULL;
|
||||||
|
|
||||||
g_static_mutex_lock (&mutex);
|
|
||||||
if (!singleton)
|
if (!singleton)
|
||||||
singleton = nm_system_config_hal_manager_new (g_connection);
|
singleton = nm_system_config_hal_manager_new (g_connection);
|
||||||
else
|
else
|
||||||
g_object_ref (singleton);
|
g_object_ref (singleton);
|
||||||
g_static_mutex_unlock (&mutex);
|
|
||||||
|
|
||||||
return singleton;
|
return singleton;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue