Commit 264aa4cd authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Make threadsafe get_type() functions.

2007-12-01  Matthias Clasen <mclasen@redhat.com>

        * gioenumtypes.c.template: Make threadsafe get_type() functions.



svn path=/trunk/; revision=6011
parent d99ce067
2007-12-01 Matthias Clasen <mclasen@redhat.com>
* gioenumtypes.c.template: Make threadsafe get_type() functions.
2007-12-01 Matthias Clasen <mclasen@redhat.com>
* gdirectorymonitor.c:
......
......@@ -258,9 +258,9 @@ CLEANFILES = \
$(marshal_sources) \
$(NULL)
gioenumtypes.h: $(gio_headers)
gioenumtypes.h: $(gio_headers) gioenumtypes.h.template
( cd $(srcdir) && $(top_builddir)/gobject/glib-mkenums --template gioenumtypes.h.template $(gio_headers) ) > gioenumtypes.h
gioenumtypes.c: $(gio_headers)
gioenumtypes.c: $(gio_headers) gioenumtypes.c.template
( cd $(srcdir) && $(top_builddir)/gobject/glib-mkenums --template gioenumtypes.c.template $(gio_headers) ) > gioenumtypes.c
......@@ -12,22 +12,26 @@
GType
@enum_name@_get_type (void)
{
static GType etype = 0;
static volatile gsize g_define_type_id__volatile = 0;
if (G_UNLIKELY(etype == 0)) {
static const G@Type@Value values[] = {
if (g_once_init_enter (&g_define_type_id__volatile))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
{ 0, NULL, NULL }
};
GType g_define_type_id =
= g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return etype;
return g_define_type_id__volatile;
}
/*** END value-tail ***/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment