[Date Prev][Date Next]
Re: A clean way to detect if a ldap_pvt_thread_mutex is locked (best would be also to know who's the owner of the lock :)
Pierangelo Masarati writes:
> I fear yet more few minor concurrency issues in libldap; I'd like to be
> able to assert if a mutex is locked from inside library functions,
Duh... please ignore my previous message. I forgot you said _assert_.
Well, that one isn't hard.
define an ldap_thread_mutex_assert_owner() which is a no-op by default.
#if <the specific thread implementation you are using>
<inspect the mutex structure and do some magic by hand>
Or more generally, use my thr_debug.c package and extend
ldap_debug_thread_cond_t with the thread ID and info about whether the
mutex is locked. Get thread ID with ldap_pvt_thread_self(), compare