Bug 129843 - pthread mutexes init-destroy balance
Summary: pthread mutexes init-destroy balance
Status: RESOLVED NOT A BUG
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-26 13:29 UTC by Alex V Breger
Modified: 2022-09-02 08:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.