https://bugs.kde.org/show_bug.cgi?id=379630
--- Comment #9 from Paul Floyd <pjfl...@wanadoo.fr> ---
There are two ways to initialize a pthread_mutex_t object:
call pthread_mutex_init() or
use the static initializer PTHREAD_MUTEX_INITIALIZER

The function way is "nice" from a Valgrind perspective since we can intercept
the function and record the initialization, as well as check that it gets
destroyed.

The static initializer is less nice - Valgrind doesn't see anything so can't do
any create/destroy validation.

llvm looks like it uses static initialization:

    __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;

Not surprising, I expect that it's faster and does the same thing.

libstdc++ code is more complicated and depends on whether __GTHREAD_MUTEX_INIT
is defined or not. If it is then static initialization is used. Which is the
case for posix systems.

Other than modifying your C++ standard library and writing a wrapper there's no
easy fix.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to