Bug 129843

Summary: pthread mutexes init-destroy balance
Product: [Developer tools] valgrind Reporter: Alex V Breger <osgxdvyg>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: pjfloyd
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alex V Breger 2006-06-26 13:29:13 UTC
Hello.

I think, that valgrind can be very useful in tracking balance of pthread mutexes
init/destroy.
The problem with pthread mutexes is that some realisations may allocate system
resourses for every mutex (e.g. on MS Windows), so every mutex must be destroyed.
Testing must be done under Linux, if we develop multiplatform application using
some variant of pthreads on windows.
Comment 1 Paul Floyd 2022-09-02 08:05:40 UTC
I'm going to close this old issue.

Whilst I can see that it would be possible to check that uses of 

       int pthread_mutex_destroy(pthread_mutex_t *mutex);
       int pthread_mutex_init(pthread_mutex_t *restrict mutex,
              const pthread_mutexattr_t *restrict attr);
are matched

I don't see how 

       pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

can be intercepted.