hokein added inline comments.
================
Comment at: clangd/TUScheduler.cpp:644
+      std::unique_lock<Semaphore> Lock(Barrier, std::try_to_lock);
+      if (Lock.owns_lock()) {
+        ExecuteAction();
----------------
ilya-biryukov wrote:
> Maybe simplify the code a bit?
> ```
> // Replacing these two lines:
> //  emitTUStatus({TUAction::Queued, Req.Name});
> //  std::lock_guard<Semaphore> BarrierLock(Barrier);
> 
> // With:
> std::unique_lock<Semaphore> BarrierLock(Barrier, std::try_to_lock);
> if (!Lock.owns_lock()) {
>   emitTUStatus({TUAction::Queued, Req.Name});
>   Lock.lock();
> }
> // Rest of the code is the same...
> ```
> 
> Avoids creating two locks and does not require helper lamdbas.
ah, good point.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55359



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to