diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-09-09 13:15:17 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-09-09 13:17:42 -0400 |
commit | 80109acef586a5a1d34f604414a36e7e18b0cede (patch) | |
tree | a742b42f4851b021d5589ed1fc8adb367f745228 /glib/gwin32.c | |
parent | 6c0dda8265a547d89b4c546298d0a29519f68749 (diff) | |
download | glib-80109acef586a5a1d34f604414a36e7e18b0cede.tar.gz |
win32: remove version init from g_thread_init_glib
Instead, make this use g_once_init_enter() in the usual way.
Diffstat (limited to 'glib/gwin32.c')
-rw-r--r-- | glib/gwin32.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/glib/gwin32.c b/glib/gwin32.c index d69f4dd8e..800c89c57 100644 --- a/glib/gwin32.c +++ b/glib/gwin32.c @@ -52,6 +52,7 @@ #endif /* _MSC_VER || __DMC__ */ #include "glib.h" +#include "gthreadprivate.h" #ifdef G_WITH_CYGWIN #include <sys/cygwin.h> @@ -492,29 +493,6 @@ g_win32_get_package_installation_subdirectory (const gchar *package, #endif -static guint windows_version; - -static void -g_win32_windows_version_init (void) -{ - static gboolean beenhere = FALSE; - - if (!beenhere) - { - beenhere = TRUE; - windows_version = GetVersion (); - - if (windows_version & 0x80000000) - g_error ("This version of GLib requires NT-based Windows."); - } -} - -void -_g_win32_thread_init (void) -{ - g_win32_windows_version_init (); -} - /** * g_win32_get_windows_version: * @@ -535,8 +513,13 @@ _g_win32_thread_init (void) guint g_win32_get_windows_version (void) { - g_win32_windows_version_init (); - + static gsize windows_version; + + g_thread_init_glib (); + + if (g_once_init_enter (&windows_version)) + g_once_init_leave (&windows_version, GetVersion ()); + return windows_version; } |