Make this function thread-safe in the GLib style.

2004-10-26  Matthias Clasen  <mclasen@redhat.com>

	* glib/gwin32.c (g_win32_get_windows_version): Make this
	function thread-safe in the GLib style.
	* glib/gthreadinit.h:
	* glib/gwin32.c (_g_win32_thread_init): New function to
	initialize the version.
	* glib/gthread.c (g_thread_init_glib): Call
	_g_win32_thread_init() from here.
This commit is contained in:
Matthias Clasen
2004-10-26 14:04:52 +00:00
committed by Matthias Clasen
parent d59b22a981
commit 9b66aa4222
8 changed files with 74 additions and 8 deletions

View File

@@ -1278,19 +1278,33 @@ g_win32_get_package_installation_subdirectory (gchar *package,
return dirname;
}
guint
g_win32_get_windows_version (void)
static guint windows_version;
static void
g_win32_windows_version_init (void)
{
static gboolean beenhere = FALSE;
static guint version;
if (!beenhere)
{
if (getenv ("G_WIN32_PRETEND_WIN9X"))
version = 0x80000004;
else
version = GetVersion ();
beenhere = TRUE;
if (getenv ("G_WIN32_PRETEND_WIN9X"))
windows_version = 0x80000004;
else
windows_version = GetVersion ();
}
return version;
}
void
_g_win32_thread_init (void)
{
g_win32_windows_version_init ();
}
guint
g_win32_get_windows_version (void)
{
g_win32_windows_version_init ();
return windows_version;
}