[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libthreads: mutex_lock holder debugging

From: Sergio Lopez
Subject: [PATCH] libthreads: mutex_lock holder debugging
Date: Fri, 14 May 2010 12:35:41 +0200


It seems that some code paths in libdiskfs still leave a mutex locked
somewhere. The original WAIT_DEBUG code in libthreads records the
thread which is holding the lock, but this is not really usefull in
Hurd's translators, since that thread is probably waiting for another
message just as everyone else, thus hiding the path that forgot to
unlock the mutex.

This patch changes mutex_lock/mutex_unlock macros to hold a pointer to
the name of the function that holds the mutex. This way, is possible
to do this:

(gdb) print disk_cache_lock
$1 = {held = 1, lock = 0, name = 0x0, queue = {head = 0x0, tail = 0x0}, 
  fname = 0x805c8de}
(gdb) x/s 0x805c8de
0x805c8de <__FUNCTION__.11276>:  "disk_pager_read_page"

I've preferred to create a new definition conditional instead of using
WAIT_DEBUG, since this one changes cproc_t structure size.

Attachment: mutex_debug.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]