[Asterisk-Dev] no mutex_assert call ?

Olle E Johansson oej at edvina.net
Tue Dec 20 01:34:25 MST 2005


Luigi Rizzo wrote:
> just wondering - does anyone know if there is a way to know the
> value of the "ownership counter" associated to a mutex ?
> 
> The fact that asterisk uses "recursive" (or "counting") mutexes
> makes it possible to protect individual functions with
> ast_mutex_lock()/ast_mutex_unlock() and not worry too much
> about entering a section of code with the proper locking in
> place. However, this makes it harder to know that we are
> really releasing the mutex in places where, for deadlock
> avoidance, we drop the lock, do something and reacquire the
> lock.
> 
> Ideally one would put asserts in the code in those places,
> but i cannot figure out how to fetch the value of the counter.
> 
Check my patches for ast_channel_lock in the issue tracker.
I use the counter for debugging messages in Linux. In FreeBSd, I could 
not find it.

/O



More information about the asterisk-dev mailing list