File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
flang/include/flang/Runtime Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1313#include < cstdio>
1414#include < cstdlib>
1515#include < thread>
16- std::thread::id main_thread_id = std::this_thread::get_id();
17- extern " C" std::thread::id get_main_thread_id () { return main_thread_id; }
1816
1917static void ConfigureFloatingPoint () {
2018#ifdef feclearexcept // a macro in some environments; omit std::
@@ -29,7 +27,10 @@ static void ConfigureFloatingPoint() {
2927#endif
3028}
3129
30+ std::thread::id _main_thread_id = std::this_thread::get_id();
3231extern " C" {
32+ std::thread::id RTNAME (GetMainThreadId)() { return _main_thread_id; }
33+
3334void RTNAME (ProgramStart)(int argc, const char *argv[], const char *envp[],
3435 const EnvironmentDefaultList *envDefaults) {
3536 std::atexit (Fortran::runtime::NotifyOtherImagesOfNormalEnd);
Original file line number Diff line number Diff line change 1313#include " flang-rt/runtime/file.h"
1414#include " flang-rt/runtime/io-error.h"
1515#include " flang-rt/runtime/terminator.h"
16+ #include " flang/Runtime/main.h"
1617#include < cfenv>
1718#include < cstdio>
1819#include < cstdlib>
1920#include < thread>
20- std::thread::id get_main_thread_id ();
2121
2222#ifdef HAVE_BACKTRACE
2323#include BACKTRACE_HEADER
@@ -81,7 +81,7 @@ static void CloseAllExternalUnits(const char *why) {
8181 std::fputc (' \n ' , stderr);
8282 DescribeIEEESignaledExceptions ();
8383 }
84- if (get_main_thread_id () != std::this_thread::get_id ())
84+ if (RTNAME (GetMainThreadId) () != std::this_thread::get_id ())
8585 std::abort ();
8686 std::exit (code);
8787}
@@ -98,7 +98,7 @@ static void CloseAllExternalUnits(const char *why) {
9898 }
9999 DescribeIEEESignaledExceptions ();
100100 }
101- if (get_main_thread_id () != std::this_thread::get_id ())
101+ if (RTNAME (GetMainThreadId) () != std::this_thread::get_id ())
102102 std::abort ();
103103 if (isErrorStop) {
104104 std::exit (EXIT_FAILURE);
Original file line number Diff line number Diff line change 1111
1212#include " flang/Runtime/c-or-cpp.h"
1313#include " flang/Runtime/entry-names.h"
14+ #include < thread>
1415
1516struct EnvironmentDefaultList ;
1617
1718FORTRAN_EXTERN_C_BEGIN
19+ std::thread::id RTNAME (GetMainThreadId)();
1820void RTNAME (ProgramStart)(
1921 int , const char *[], const char *[], const struct EnvironmentDefaultList *);
2022void RTNAME (ByteswapOption)(void ); // -byteswapio
You can’t perform that action at this time.
0 commit comments