[Openmp-commits] [PATCH] D121057: [OpenMP][FIX] Ensure exclusive access to the HDTT map

Johannes Doerfert via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Sun Mar 6 14:53:21 PST 2022


jdoerfert added inline comments.


================
Comment at: openmp/libomptarget/include/ExclusiveAccess.h:41
+  Accessor(ProtectedObj<Ty> &PO, bool DoNotGetAccess = false)
+      : Ptr(DoNotGetAccess ? nullptr : &PO) {
+    lock();
----------------
JonChesterfield wrote:
> Do we have multiple threads waiting to gain access to this thing? If not, asserting that it wasn't locked to begin with might be helpful for catching errors at the call site.
We do have multiple threads in play or this entire thing would be reasonably useless ;)


================
Comment at: openmp/libomptarget/include/ExclusiveAccess.h:83
+template <typename Ty>
+Accessor<Ty> &&ProtectedObj<Ty>::getExclusiveAccessor(bool DoNotGetAccess) {
+  return std::move(Accessor<Ty>(*this, DoNotGetAccess));
----------------
JonChesterfield wrote:
> Not sure we need the move here, it's already an R value. Also not sure we need the && on the return type.
Because we don't want to copy it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121057/new/

https://reviews.llvm.org/D121057



More information about the Openmp-commits mailing list