This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Pthread mutex lock validator


sanketh nalli wrote:

> I started with this project. But i soon, realised that it may not
> be possible.
[...]
> And the custom pthread_mutex_t has to store
> some extra information to help detect recursive locking,

One way would be to keep a separate table that stores that extra
information for each (pthread_mutex_t *) value encountered.

As POSIX explains under the heading pthread_mutex_init(), the effect
of referring to copies of a mutex in calls to pthread_mutex_lock(),
..._unlock(), and so on is undefined, so the address of a mutex should
work as a key and this doesn't require any knowledge of what is inside
a pthread_mutex_t.

Hope that helps,
Jonathan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]