replace C-style concurrent initialization of statics
C++ statics are thread-safe as is and are usually implemented more efficiently. Besides, `volatile` is likely misused here anyway.
This commit is contained in:
parent
8988b77d57
commit
7b6f3ea9f6
|
@ -7,17 +7,12 @@
|
||||||
GType \
|
GType \
|
||||||
type_name ## _get_type (void) \
|
type_name ## _get_type (void) \
|
||||||
{ \
|
{ \
|
||||||
static volatile gsize g_define_id__volatile = 0; \
|
static constexpr GEnumValue v[] = { \
|
||||||
if (g_once_init_enter (&g_define_id__volatile)) \
|
values \
|
||||||
{ \
|
{ 0, NULL, NULL }, \
|
||||||
static const GEnumValue v[] = { \
|
}; \
|
||||||
values \
|
static const auto enum_type_id = g_enum_register_static (g_intern_static_string (#TypeName), v); \
|
||||||
{ 0, NULL, NULL }, \
|
return enum_type_id; \
|
||||||
}; \
|
|
||||||
GType g_define_id = g_enum_register_static (g_intern_static_string (#TypeName), v); \
|
|
||||||
g_once_init_leave (&g_define_id__volatile, g_define_id); \
|
|
||||||
} \
|
|
||||||
return g_define_id__volatile; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WINRT_GLIB_DEFINE_ENUM_TYPE (winrtWindowsUINotificationsToastDismissalReason, winrt_windows_ui_notifications_toast_dismissal_reason,
|
WINRT_GLIB_DEFINE_ENUM_TYPE (winrtWindowsUINotificationsToastDismissalReason, winrt_windows_ui_notifications_toast_dismissal_reason,
|
||||||
|
|
Loading…
Reference in a new issue