Skip to content

Commit b314844

Browse files
committed
[UR] Workaround the shutdown order issue in log on Linux as well
1 parent e3fc36d commit b314844

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

unified-runtime/source/common/logger/ur_sinks.hpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
namespace logger {
2222

23-
#if defined(_WIN32)
2423
inline bool isTearDowned = false;
25-
#endif
2624

2725
class Sink {
2826
public:
@@ -45,21 +43,17 @@ class Sink {
4543

4644
std::string message = buffer.str();
4745

48-
// This is a temporary workaround on windows, where UR adapter is teardowned
46+
// This is a temporary workaround, where UR adapter is teardowned
4947
// before the UR loader, which will result in access violation when we use print
5048
// function as the overrided print function was already released with the UR
5149
// adapter.
5250
// TODO: Change adapters to use a common sink class in the loader instead of
5351
// using thier own sink class that inherit from logger::Sink.
54-
#if defined(_WIN32)
55-
if (isTearDowned) {
56-
std::cerr << message;
57-
} else {
58-
print(level, message);
59-
}
60-
#else
61-
print(level, message);
62-
#endif
52+
if (isTearDowned) {
53+
std::cerr << message;
54+
} else {
55+
print(level, message);
56+
}
6357
}
6458

6559
void setFileLine(bool fileline) { add_fileline = fileline; }
@@ -194,9 +188,7 @@ class StderrSink : public Sink {
194188
}
195189

196190
~StderrSink() {
197-
#if defined(_WIN32)
198191
logger::isTearDowned = true;
199-
#endif
200192
}
201193
};
202194

0 commit comments

Comments
 (0)