On Thu, Oct 6, 2016 at 8:53 AM, Alex Bligh <a...@alex.org.uk> wrote:
>
>
> > On 6 Oct 2016, at 16:06, Mateusz Jemielity <m.jemiel...@is-wireless.com>
wrote:
> >
> > The effects are equivalent to pthread_rwlock_init, thus in my opinion
they
> > require pthread_rwlock_destroy.
>
> However, I'm not sure why you'd need to call pthread_*_destroy on a
statically
> initialised object, given that presumably you destroy it when the program
> is about to exit and the resources would be given back to the OS anyway.

In this example it is in main(), but there is no reason the same sequence
could not appear in the middle of a long-running program, in which case
failing to call pthread_rwlock_destroy() could potentially leak resources.

I agree with Mateusz. POSIX clearly requires a call to
pthread_rwlock_destroy() on RW locks initialized via PTHREAD_RW_INITIALIZER
to ensure proper freeing of resources.

 - Pat
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to