_g_main_thread_init ();
_g_utils_thread_init ();
_g_futex_thread_init ();
-#ifdef G_OS_WIN32
- _g_win32_thread_init ();
-#endif
}
/* The following sections implement: GOnce, GStaticMutex, GStaticRecMutex,
G_GNUC_INTERNAL void _g_futex_thread_init (void);
G_GNUC_INTERNAL void _g_thread_impl_init (void);
-#ifdef G_OS_WIN32
-G_GNUC_INTERNAL void _g_win32_thread_init (void);
-#endif /* G_OS_WIN32 */
-
G_END_DECLS
#endif /* __G_THREADPRIVATE_H__ */
#endif /* _MSC_VER || __DMC__ */
#include "glib.h"
+#include "gthreadprivate.h"
#ifdef G_WITH_CYGWIN
#include <sys/cygwin.h>
#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:
*
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;
}