[Openmp-commits] [PATCH] D84799: [OpenMP] Replaced mutex lock/unlock in `target` with `std::lock_guard`

Ye Luo via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 28 14:04:04 PDT 2020


ye-luo added a comment.

Only one minor issue. Your initial sophisticated patch made my thought you replaced all the lock/unlock. After splitting, the change becomes very clean.



================
Comment at: openmp/libomptarget/src/omptarget.cpp:766
   // get target table.
-  TrlTblMtx->lock();
-  assert(TM->Table->TargetsTable.size() > (size_t)DeviceId &&
-         "Not expecting a device ID outside the table's bounds!");
-  __tgt_target_table *TargetTable = TM->Table->TargetsTable[DeviceId];
-  TrlTblMtx->unlock();
+  __tgt_target_table *TargetTable;
+  {
----------------
Pull nullptr initial value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84799



More information about the Openmp-commits mailing list