2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 <2020> 2021 2022 2023 2024 | Index | 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 <2020> 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | c++ thread_local and atexit() |
From: | Michael Davidsaver via Core-talk <core-talk at aps.anl.gov> |
To: | EPICS core-talk <core-talk at aps.anl.gov> |
Date: | Fri, 24 Apr 2020 14:36:55 -0700 |
FYI. glibc at least seems not to follow the required ordering when destructing thread_local objects on the main thread. I read the language at https://en.cppreference.com/w/cpp/utility/program/exit as saying that thread_local destruction and atexit callbacks should be mixed based on the reverse order in of constructors and atexit() calls. However, glibc strictly destroys all thread_local before running any atexit callbacks. https://github.com/bminor/glibc/blob/5f72f9800b250410cad3abfeeb09469ef12b2438/stdlib/exit.c#L38