[Openmp-commits] [openmp] [Libomptarget] Remove global ctor and use reference counting (PR #80499)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 6 08:38:58 PST 2024


================
@@ -20,25 +20,37 @@
 extern void llvm::omp::target::ompt::connectLibrary();
 #endif
 
-__attribute__((constructor(101))) void init() {
+static std::mutex PluginMtx;
+static std::atomic<uint32_t> RefCount = 0;
----------------
jdoerfert wrote:

Why is this atomic, it seems all accesses are guarded by PluginMtx?

https://github.com/llvm/llvm-project/pull/80499


More information about the Openmp-commits mailing list