[PATCH] D51187: [RFC] Thread safety analysis: Track status of scoped capability

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 13 16:04:13 PDT 2018


aaronpuchert planned changes to this revision.
aaronpuchert added a comment.

This doesn't work with loops yet:

  void relockLoop() {
    RelockableExclusiveMutexLock scope(&mu);
  
    while (b) {
      scope.Unlock(); // releasing mutex 'scope' that was not held
      scope.Lock();   // acquiring mutex 'mu' that is already held
    }
  }

There should be no warnings here — this code is fine.


Repository:
  rC Clang

https://reviews.llvm.org/D51187





More information about the cfe-commits mailing list