We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae1184d commit 10546f1Copy full SHA for 10546f1
sycl/source/detail/xpti_registry.hpp
@@ -8,6 +8,7 @@
8
9
#pragma once
10
11
+#include <mutex>
12
#include <string>
13
#include <unordered_set>
14
@@ -33,10 +34,7 @@ class XPTIRegistry {
33
34
public:
35
void initializeFrameworkOnce() {
36
#ifdef XPTI_ENABLE_INSTRUMENTATION
- if (!MInitialized) {
37
- xptiFrameworkInitialize();
38
- MInitialized = true;
39
- }
+ std::call_once(MInitialized, [] { xptiFrameworkInitialize(); });
40
#endif
41
}
42
@@ -65,7 +63,7 @@ class XPTIRegistry {
65
63
66
64
private:
67
std::unordered_set<std::string> MActiveStreams;
68
- bool MInitialized = false;
+ std::once_flag MInitialized;
69
};
70
} // namespace detail
71
} // namespace sycl
0 commit comments