diff options
author | Martin Sebor <msebor@redhat.com> | 2015-07-01 14:05:27 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2015-07-01 14:05:27 -0600 |
commit | ed225df3ad9cbac3c22ec3f0fbbed1f9c61d1c54 (patch) | |
tree | 175abf6476b8924e619c559993324efdb855e392 /nptl/Makefile | |
parent | 9081b7bcb11e74cd2d4363663ccd1bb641392719 (diff) | |
download | glibc-ed225df3ad9cbac3c22ec3f0fbbed1f9c61d1c54.zip glibc-ed225df3ad9cbac3c22ec3f0fbbed1f9c61d1c54.tar.gz glibc-ed225df3ad9cbac3c22ec3f0fbbed1f9c61d1c54.tar.bz2 |
The C++ 2011 std::call_once function is specified to allow
the initialization routine to exit by throwing an exception.
Such an execution, termed exceptional, requires call_once to
propagate the exception to its caller. A program may contain
any number of exceptional executions but only one returning
execution (which, if it exists, must be the last execution
with the same once flag).
On POSIX systems such as Linux, std::call_once is implemented
in terms of pthread_once. However, as discussed in libstdc++
bug 66146 - "call_once not C++11-compliant on ppc64le," GLIBC's
pthread_once hangs when the initialization function exits by
throwing an exception on at least arm and ppc64 (though
apparently not on x86_64). This effectively prevents call_once
from conforming to the C++ requirements since there doesn't
appear to be a thread-safe way to work around this problem in
libstdc++.
This patch changes pthread_once to handle gracefully init
functions that exit by throwing exceptions. It was successfully
tested on ppc64, ppc64le, and x86_64.
[BZ #18435]
* nptl/Makefile: Add tst-once5.cc.
* nptl/pthreadP.h (pthread_cleanup_push, pthread_cleanup_pop):
Remove macro redefinitions.
* nptl/tst-once5.cc: New test.
Diffstat (limited to 'nptl/Makefile')
-rw-r--r-- | nptl/Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/nptl/Makefile b/nptl/Makefile index 530d14b..4544aa2 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -211,6 +211,7 @@ CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions +LDLIBS-tst-once5 = -lstdc++ tests = tst-typesizes \ tst-attr1 tst-attr2 tst-attr3 tst-default-attr \ @@ -233,7 +234,7 @@ tests = tst-typesizes \ tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 \ tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \ tst-rwlock15 tst-rwlock16 \ - tst-once1 tst-once2 tst-once3 tst-once4 \ + tst-once1 tst-once2 tst-once3 tst-once4 tst-once5 \ tst-key1 tst-key2 tst-key3 tst-key4 \ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \ |