Added debug information for g_mutex_free calls, if G_ERRORCHECK_MUTEXES is

2001-01-30  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* gthread.h (g_cond_wait): Added debug information for
	g_mutex_free calls, if G_ERRORCHECK_MUTEXES is defined.

	* gthread/gthread-impl.c (g_mutex_free_errorcheck_impl): Fixed it for
	real. Sorry for this mess. It looked like a real obvious fix, so I
	didn't check. Bad boy. Added some casts to quiet the compiler.
This commit is contained in:
Sebastian Wilhelmi
2001-01-30 09:03:22 +00:00
committed by Sebastian Wilhelmi
parent f9da22ef07
commit 1f46d9f68f
12 changed files with 99 additions and 38 deletions

View File

@@ -1,3 +1,9 @@
2001-01-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gthread-impl.c (g_mutex_free_errorcheck_impl): Fixed it for
real. Sorry for this mess. It looked like a real obvious fix, so I
didn't check. Bad boy. Added some casts to quiet the compiler.
2001-01-29 Havoc Pennington <hp@redhat.com>
* gthread-impl.c (g_mutex_free_errorcheck_impl): hack this so it

View File

@@ -179,14 +179,19 @@ g_mutex_unlock_errorcheck_impl (GMutex *mutex,
}
static void
g_mutex_free_errorcheck_impl (GMutex *mutex)
g_mutex_free_errorcheck_impl (GMutex *mutex,
gulong magic,
gchar *location)
{
ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
if (magic != G_MUTEX_DEBUG_MAGIC)
location = "unknown";
if (info && info->owner != NULL)
g_error ("Trying to free a locked mutex at '%s', "
"which was previously locked at '%s'",
"FIXME", info->location);
location, info->location);
g_free (G_MUTEX_DEBUG_INFO (mutex));
g_thread_functions_for_glib_use_default.mutex_free (mutex);
@@ -259,7 +264,7 @@ g_cond_timed_wait_errorcheck_impl (GCond *cond,
}
/* unshadow function declaration. See glib.h */
/* unshadow function declaration. See gthread.h */
#undef g_thread_init
void
@@ -277,9 +282,13 @@ g_thread_init_with_errorcheck_mutexes (GThreadFunctions* init)
(gboolean (*)(GMutex *)) g_mutex_trylock_errorcheck_impl;
errorcheck_functions.mutex_unlock =
(void (*)(GMutex *)) g_mutex_unlock_errorcheck_impl;
errorcheck_functions.mutex_free = g_mutex_free_errorcheck_impl;
errorcheck_functions.cond_wait = g_cond_wait_errorcheck_impl;
errorcheck_functions.cond_timed_wait = g_cond_timed_wait_errorcheck_impl;
errorcheck_functions.mutex_free =
(void (*)(GMutex *)) g_mutex_free_errorcheck_impl;
errorcheck_functions.cond_wait =
(void (*)(GCond *, GMutex *)) g_cond_wait_errorcheck_impl;
errorcheck_functions.cond_timed_wait =
(gboolean (*)(GCond *, GMutex *, GTimeVal *))
g_cond_timed_wait_errorcheck_impl;
g_thread_init (&errorcheck_functions);
}