win32: remove version init from g_thread_init_glib

Instead, make this use g_once_init_enter() in the usual way.
This commit is contained in:
Ryan Lortie 2011-09-09 13:15:17 -04:00
parent 6c0dda8265
commit 80109acef5
3 changed files with 8 additions and 32 deletions

View File

@ -964,9 +964,6 @@ g_thread_init_glib (void)
_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,

View File

@ -61,10 +61,6 @@ G_GNUC_INTERNAL void _g_utils_thread_init (void);
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__ */

View File

@ -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;
}