public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] libstdc++: eh_globals: gthreads: reset _S_init before deleting key
@ 2022-06-21 0:08 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-21 0:08 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:b99549b5d895911fe4a0ef12b6f90652208c728d
commit b99549b5d895911fe4a0ef12b6f90652208c728d
Author: Alexandre Oliva <oliva@adacore.com>
Date: Mon Jun 20 19:45:08 2022 -0300
libstdc++: eh_globals: gthreads: reset _S_init before deleting key
Clear __eh_globals_init's _S_init in the dtor before deleting the
gthread key.
This ensures that, in case any code involved in deleting the key
interacts with eh_globals, the key that is being deleted won't be
used, and the non-thread-specific eh_globals fallback will.
for libstdc++-v3/ChangeLog
* libsupc++/eh_globals.cc [!_GLIBCXX_HAVE_TLS]
(__eh_globals_init::~__eh_globals_init): Clear _S_init first.
Diff:
---
libstdc++-v3/libsupc++/eh_globals.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/libsupc++/eh_globals.cc b/libstdc++-v3/libsupc++/eh_globals.cc
index 768425c0f40..0aadb692a96 100644
--- a/libstdc++-v3/libsupc++/eh_globals.cc
+++ b/libstdc++-v3/libsupc++/eh_globals.cc
@@ -119,8 +119,13 @@ struct __eh_globals_init
~__eh_globals_init()
{
if (_S_init)
- __gthread_key_delete(_M_key);
- _S_init = false;
+ {
+ /* Set it before the call, so that, should
+ __gthread_key_delete throw an exception, it won't rely on
+ the key being deleted. */
+ _S_init = false;
+ __gthread_key_delete(_M_key);
+ }
}
__eh_globals_init(const __eh_globals_init&) = delete;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] libstdc++: eh_globals: gthreads: reset _S_init before deleting key
@ 2022-06-22 0:44 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-22 0:44 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:9a90a804bf901c2d6cf9ba93725c17e75d8f09ec
commit 9a90a804bf901c2d6cf9ba93725c17e75d8f09ec
Author: Alexandre Oliva <oliva@adacore.com>
Date: Mon Jun 20 19:45:08 2022 -0300
libstdc++: eh_globals: gthreads: reset _S_init before deleting key
Clear __eh_globals_init's _S_init in the dtor before deleting the
gthread key.
This ensures that, in case any code involved in deleting the key
interacts with eh_globals, the key that is being deleted won't be
used, and the non-thread-specific eh_globals fallback will.
for libstdc++-v3/ChangeLog
* libsupc++/eh_globals.cc [!_GLIBCXX_HAVE_TLS]
(__eh_globals_init::~__eh_globals_init): Clear _S_init first.
Diff:
---
libstdc++-v3/libsupc++/eh_globals.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/libsupc++/eh_globals.cc b/libstdc++-v3/libsupc++/eh_globals.cc
index 768425c0f40..0aadb692a96 100644
--- a/libstdc++-v3/libsupc++/eh_globals.cc
+++ b/libstdc++-v3/libsupc++/eh_globals.cc
@@ -119,8 +119,13 @@ struct __eh_globals_init
~__eh_globals_init()
{
if (_S_init)
- __gthread_key_delete(_M_key);
- _S_init = false;
+ {
+ /* Set it before the call, so that, should
+ __gthread_key_delete throw an exception, it won't rely on
+ the key being deleted. */
+ _S_init = false;
+ __gthread_key_delete(_M_key);
+ }
}
__eh_globals_init(const __eh_globals_init&) = delete;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] libstdc++: eh_globals: gthreads: reset _S_init before deleting key
@ 2022-06-21 0:16 Alexandre Oliva
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Oliva @ 2022-06-21 0:16 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:9118254e4ebff9bd11a83549589c02d0e0de3ef4
commit 9118254e4ebff9bd11a83549589c02d0e0de3ef4
Author: Alexandre Oliva <oliva@adacore.com>
Date: Mon Jun 20 19:45:08 2022 -0300
libstdc++: eh_globals: gthreads: reset _S_init before deleting key
Clear __eh_globals_init's _S_init in the dtor before deleting the
gthread key.
This ensures that, in case any code involved in deleting the key
interacts with eh_globals, the key that is being deleted won't be
used, and the non-thread-specific eh_globals fallback will.
for libstdc++-v3/ChangeLog
* libsupc++/eh_globals.cc [!_GLIBCXX_HAVE_TLS]
(__eh_globals_init::~__eh_globals_init): Clear _S_init first.
Diff:
---
libstdc++-v3/libsupc++/eh_globals.cc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/libsupc++/eh_globals.cc b/libstdc++-v3/libsupc++/eh_globals.cc
index 768425c0f40..0aadb692a96 100644
--- a/libstdc++-v3/libsupc++/eh_globals.cc
+++ b/libstdc++-v3/libsupc++/eh_globals.cc
@@ -119,8 +119,13 @@ struct __eh_globals_init
~__eh_globals_init()
{
if (_S_init)
- __gthread_key_delete(_M_key);
- _S_init = false;
+ {
+ /* Set it before the call, so that, should
+ __gthread_key_delete throw an exception, it won't rely on
+ the key being deleted. */
+ _S_init = false;
+ __gthread_key_delete(_M_key);
+ }
}
__eh_globals_init(const __eh_globals_init&) = delete;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-22 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 0:08 [gcc(refs/users/aoliva/heads/testme)] libstdc++: eh_globals: gthreads: reset _S_init before deleting key Alexandre Oliva
2022-06-21 0:16 Alexandre Oliva
2022-06-22 0:44 Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).