Make this function thread-safe in the GLib style.
authorMatthias Clasen <mclasen@redhat.com>
Tue, 26 Oct 2004 14:04:52 +0000 (14:04 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 26 Oct 2004 14:04:52 +0000 (14:04 +0000)
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.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gthread.c
glib/gthreadinit.h
glib/gwin32.c

index 207146a6c9fdb73d1606da1d936cca1f9383addf..08771e0efab431690ee80116e406a560dd9cae46 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
 2004-10-26  Ray Strode  <rstrode@redhat.com>
 
        * glib/gkeyfile.c: Add Matthias to "Written by" lines
index 207146a6c9fdb73d1606da1d936cca1f9383addf..08771e0efab431690ee80116e406a560dd9cae46 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2004-10-26  Ray Strode  <rstrode@redhat.com>
 
        * glib/gkeyfile.c: Add Matthias to "Written by" lines
index 207146a6c9fdb73d1606da1d936cca1f9383addf..08771e0efab431690ee80116e406a560dd9cae46 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2004-10-26  Ray Strode  <rstrode@redhat.com>
 
        * glib/gkeyfile.c: Add Matthias to "Written by" lines
index 207146a6c9fdb73d1606da1d936cca1f9383addf..08771e0efab431690ee80116e406a560dd9cae46 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2004-10-26  Ray Strode  <rstrode@redhat.com>
 
        * glib/gkeyfile.c: Add Matthias to "Written by" lines
index 207146a6c9fdb73d1606da1d936cca1f9383addf..08771e0efab431690ee80116e406a560dd9cae46 100644 (file)
@@ -1,3 +1,13 @@
+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.
+
 2004-10-26  Ray Strode  <rstrode@redhat.com>
 
        * glib/gkeyfile.c: Add Matthias to "Written by" lines
index 9505b1593e9373b32d8a1217dff66003ba7cd554..55225a6e0df2f93bf43ce2885d7e826bec04e7a5 100644 (file)
@@ -152,6 +152,7 @@ g_thread_init_glib (void)
   _g_mem_thread_init ();
   _g_messages_thread_init ();
   _g_atomic_thread_init ();
+  _g_win32_thread_init ();
  
   g_threads_got_initialized = TRUE;
 
index a7242d27466fee03762ac765670052ff70b6899c..0af3b60a12603ff6071ae65d94f17c04a53107a4 100644 (file)
@@ -33,6 +33,7 @@ void _g_convert_thread_init (void) G_GNUC_INTERNAL;
 void _g_rand_thread_init (void) G_GNUC_INTERNAL;
 void _g_main_thread_init (void) G_GNUC_INTERNAL;
 void _g_atomic_thread_init (void) G_GNUC_INTERNAL;
+void _g_win32_thread_init (void) G_GNUC_INTERNAL;
 
 /* Are called from glib/gthread.c. Must only contain g_private_new calls */
 void _g_mem_thread_private_init (void) G_GNUC_INTERNAL;
index 05d49b32d62cb8a6aedf69d079ded3bb9fbd2a24..17fcf6ce4a7019a82077e2764ee50ae863a5d54c 100644 (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)
     {
+      beenhere = TRUE;
       if (getenv ("G_WIN32_PRETEND_WIN9X"))
-       version = 0x80000004;
+       windows_version = 0x80000004;
       else
-       version = GetVersion ();
-      beenhere = TRUE;
+       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;
 }