This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Gthreads patch to disable static initializer macros


PRs libstdc++/51296 and libstdc++/51906 are both caused by problems
with the Pthreads static initializer macros such as
PTHREAD_MUTEX_INITIALIZER.

On Tru64 PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER can
only be used for statically-initialized variables, as allowed by POSIX
currently, but http://austingroupbugs.net/view.php?id=70#c127 removes
that limitation for the next POSIX standard. C++11 needs to use those
macros for variables with automatic and dynamic scope, because the
init functions can't be used in constexpr constructors.

On Mac OS X 10.7 the PTHREAD_RECURSIVE_MUTEX_INITIALIZER is buggy.
This has shown up now because C++11 threads weren't enabled on darwin
before 4.7

My suggestion is to modify gthr-posix.h with the attached patch, so
that target maintainers can define e.g.
_GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC to force use of the init
function instead of the __GTHREAD_RECURSIVE_MUTEX_INIT initializer.
The patch includes a change to do that for darwin.

This has been testing on darwin, if Rainer tests it successfully on
Tru64 will the gthr-posix.h change be acceptable?

Attachment: gthr-init.txt
Description: Text document


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