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 13
13
#include < cstdio>
14
14
#include < cstdlib>
15
15
#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; }
18
16
19
17
static void ConfigureFloatingPoint () {
20
18
#ifdef feclearexcept // a macro in some environments; omit std::
@@ -29,7 +27,10 @@ static void ConfigureFloatingPoint() {
29
27
#endif
30
28
}
31
29
30
+ std::thread::id _main_thread_id = std::this_thread::get_id();
32
31
extern " C" {
32
+ std::thread::id RTNAME (GetMainThreadId)() { return _main_thread_id; }
33
+
33
34
void RTNAME (ProgramStart)(int argc, const char *argv[], const char *envp[],
34
35
const EnvironmentDefaultList *envDefaults) {
35
36
std::atexit (Fortran::runtime::NotifyOtherImagesOfNormalEnd);
Original file line number Diff line number Diff line change 13
13
#include " flang-rt/runtime/file.h"
14
14
#include " flang-rt/runtime/io-error.h"
15
15
#include " flang-rt/runtime/terminator.h"
16
+ #include " flang/Runtime/main.h"
16
17
#include < cfenv>
17
18
#include < cstdio>
18
19
#include < cstdlib>
19
20
#include < thread>
20
- std::thread::id get_main_thread_id ();
21
21
22
22
#ifdef HAVE_BACKTRACE
23
23
#include BACKTRACE_HEADER
@@ -81,7 +81,7 @@ static void CloseAllExternalUnits(const char *why) {
81
81
std::fputc (' \n ' , stderr);
82
82
DescribeIEEESignaledExceptions ();
83
83
}
84
- if (get_main_thread_id () != std::this_thread::get_id ())
84
+ if (RTNAME (GetMainThreadId) () != std::this_thread::get_id ())
85
85
std::abort ();
86
86
std::exit (code);
87
87
}
@@ -98,7 +98,7 @@ static void CloseAllExternalUnits(const char *why) {
98
98
}
99
99
DescribeIEEESignaledExceptions ();
100
100
}
101
- if (get_main_thread_id () != std::this_thread::get_id ())
101
+ if (RTNAME (GetMainThreadId) () != std::this_thread::get_id ())
102
102
std::abort ();
103
103
if (isErrorStop) {
104
104
std::exit (EXIT_FAILURE);
Original file line number Diff line number Diff line change 11
11
12
12
#include " flang/Runtime/c-or-cpp.h"
13
13
#include " flang/Runtime/entry-names.h"
14
+ #include < thread>
14
15
15
16
struct EnvironmentDefaultList ;
16
17
17
18
FORTRAN_EXTERN_C_BEGIN
19
+ std::thread::id RTNAME (GetMainThreadId)();
18
20
void RTNAME (ProgramStart)(
19
21
int , const char *[], const char *[], const struct EnvironmentDefaultList *);
20
22
void RTNAME (ByteswapOption)(void ); // -byteswapio
You can’t perform that action at this time.
0 commit comments