[gvfs] Use GOnce for interface type registration
- From: Tomas Bzatek <tbzatek src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] Use GOnce for interface type registration
- Date: Wed, 29 May 2013 14:19:01 +0000 (UTC)
commit f389246b60f3ce6d528af01f15a296b122815cd0
Author: Tomas Bzatek <tbzatek redhat com>
Date: Wed May 29 16:17:30 2013 +0200
Use GOnce for interface type registration
Related to https://bugs.freedesktop.org/show_bug.cgi?id=65130
daemon/gvfsjobsource.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/daemon/gvfsjobsource.c b/daemon/gvfsjobsource.c
index 29878cc..6d65270 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]