From: Sebastian Wilhelmi Date: Fri, 18 May 2001 08:36:44 +0000 (+0000) Subject: Fixed mutex deadlock. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=a70206f1770b436525fb151e954d0aa60e2ef051;p=dana%2Fcg-glib.git Fixed mutex deadlock. 2001-05-18 Sebastian Wilhelmi * gmem.c (g_mem_profile): Fixed mutex deadlock. --- diff --git a/ChangeLog b/ChangeLog index be08eede..a4922ba1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index be08eede..a4922ba1 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +2001-05-18 Sebastian Wilhelmi + + * gmem.c (g_mem_profile): Fixed mutex deadlock. + 2001-05-17 Sebastian Wilhelmi * makefile.mingw.in: Add gpattern.o to objects. diff --git a/glib/gmem.c b/glib/gmem.c index 805f6bdb..616614b9 100644 --- a/glib/gmem.c +++ b/glib/gmem.c @@ -363,22 +363,31 @@ void g_mem_profile (void) { guint local_data[(MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])]; - gulong local_allocs = profile_allocs; - gulong local_zinit = profile_zinit; - gulong local_frees = profile_frees; - gulong local_mc_allocs = profile_mc_allocs; - gulong local_mc_frees = profile_mc_frees; + gulong local_allocs; + gulong local_zinit; + gulong local_frees; + gulong local_mc_allocs; + gulong local_mc_frees; g_mutex_lock (g_profile_mutex); + local_allocs = profile_allocs; + local_zinit = profile_zinit; + local_frees = profile_frees; + local_mc_allocs = profile_mc_allocs; + local_mc_frees = profile_mc_frees; + if (!profile_data) { g_mutex_unlock (g_profile_mutex); return; } - memcpy (local_data, profile_data, (MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])); + memcpy (local_data, profile_data, + (MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])); + g_mutex_unlock (g_profile_mutex); + g_print ("GLib Memory statistics (successful operations):\n"); profile_print_locked (local_data, TRUE); g_print ("GLib Memory statistics (failing operations):\n"); @@ -395,7 +404,6 @@ g_mem_profile (void) local_mc_frees, ((gdouble) local_mc_frees) / local_mc_allocs * 100.0, local_mc_allocs - local_mc_frees); - g_mutex_unlock (g_profile_mutex); } static gpointer diff --git a/gmem.c b/gmem.c index 805f6bdb..616614b9 100644 --- a/gmem.c +++ b/gmem.c @@ -363,22 +363,31 @@ void g_mem_profile (void) { guint local_data[(MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])]; - gulong local_allocs = profile_allocs; - gulong local_zinit = profile_zinit; - gulong local_frees = profile_frees; - gulong local_mc_allocs = profile_mc_allocs; - gulong local_mc_frees = profile_mc_frees; + gulong local_allocs; + gulong local_zinit; + gulong local_frees; + gulong local_mc_allocs; + gulong local_mc_frees; g_mutex_lock (g_profile_mutex); + local_allocs = profile_allocs; + local_zinit = profile_zinit; + local_frees = profile_frees; + local_mc_allocs = profile_mc_allocs; + local_mc_frees = profile_mc_frees; + if (!profile_data) { g_mutex_unlock (g_profile_mutex); return; } - memcpy (local_data, profile_data, (MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])); + memcpy (local_data, profile_data, + (MEM_PROFILE_TABLE_SIZE + 1) * 8 * sizeof (profile_data[0])); + g_mutex_unlock (g_profile_mutex); + g_print ("GLib Memory statistics (successful operations):\n"); profile_print_locked (local_data, TRUE); g_print ("GLib Memory statistics (failing operations):\n"); @@ -395,7 +404,6 @@ g_mem_profile (void) local_mc_frees, ((gdouble) local_mc_frees) / local_mc_allocs * 100.0, local_mc_allocs - local_mc_frees); - g_mutex_unlock (g_profile_mutex); } static gpointer