Use g_once_init_*() instead of GOnce for the enum types

This commit is contained in:
Sebastian Dröge 2009-04-15 19:58:34 +02:00
parent 484c3272c4
commit c09069c889

View file

@ -227,9 +227,9 @@ gstenumtypes.c: $(gst_headers)
glib-mkenums \
--fhead "#include \"gst_private.h\"\n#include <gst/gst.h>\n#define C_ENUM(v) ((gint) v)\n#define C_FLAGS(v) ((guint) v)\n " \
--fprod "\n/* enumerations from \"@filename@\" */" \
--vhead "static void\nregister_@enum_name@ (GType* id)\n{\n static const G@Type@Value values[] = {" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static gsize id = 0;\n static const G@Type@Value values[] = {" \
--vprod " { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n *id = g_@type@_register_static (\"@EnumName@\", values);\n}\nGType\n@enum_name@_get_type (void)\n{\n static GType id;\n static GOnce once = G_ONCE_INIT;\n\n g_once (&once, (GThreadFunc)register_@enum_name@, &id);\n return id;\n}\n" \
--vtail " { 0, NULL, NULL }\n };\n\n if (g_once_init_enter (&id)) {\n GType tmp = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&id, tmp);\n }\n\n return (GType) id;\n}" \
$^ > gstenumtypes.c
%.c.gcov: .libs/libgstreamer_@GST_MAJORMINOR@_la-%.gcda %.c