diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2013-05-29 16:17:30 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2013-05-29 16:17:30 +0200 |
commit | f389246b60f3ce6d528af01f15a296b122815cd0 (patch) | |
tree | 37f2d3d7e2d35f84324530c5b3aa7b89e85a92d8 /daemon/gvfsjobsource.c | |
parent | 54f23f2d89a4b066f19f5e56108fc0464df25585 (diff) | |
download | gvfs-f389246b60f3ce6d528af01f15a296b122815cd0.tar.gz |
Use GOnce for interface type registration
Related to https://bugs.freedesktop.org/show_bug.cgi?id=65130
Diffstat (limited to 'daemon/gvfsjobsource.c')
-rw-r--r-- | daemon/gvfsjobsource.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/daemon/gvfsjobsource.c b/daemon/gvfsjobsource.c index 29878ccf..6d65270a 100644 --- a/daemon/gvfsjobsource.c +++ b/daemon/gvfsjobsource.c @@ -36,9 +36,9 @@ static guint signals[LAST_SIGNAL] = { 0 }; GType g_vfs_job_source_get_type (void) { - static GType vfs_job_source_type = 0; + static volatile gsize g_define_type_id__volatile = 0; - if (! vfs_job_source_type) + if (g_once_init_enter (&g_define_type_id__volatile)) { static const GTypeInfo vfs_job_source_info = { @@ -53,14 +53,15 @@ g_vfs_job_source_get_type (void) NULL }; - vfs_job_source_type = + GType vfs_job_source_type = g_type_register_static (G_TYPE_INTERFACE, "GVfsJobSource", &vfs_job_source_info, 0); g_type_interface_add_prerequisite (vfs_job_source_type, G_TYPE_OBJECT); + g_once_init_leave (&g_define_type_id__volatile, vfs_job_source_type); } - return vfs_job_source_type; + return g_define_type_id__volatile; } |