[PATCH] D49355: Thread safety analysis: Allow lock upgrading and downgrading

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 15:06:20 PDT 2018


aaronpuchert added a comment.

It seems @phosek was able to fix the issue in https://github.com/flutter/engine/pull/5944. By the way, a nice way to think about the attributes is that they encode state transitions as shown in the following table. This change fills the remaining two gaps.

|                  | unlocked         | locked exclusive | locked  shared    |
| unlocked/unknown | `EXCLUDES`       | `ACQUIRE`        | `ACQUIRE_SHARED`  |
| locked exclusive | `RELEASE`        | `REQUIRES`       |                   |
| locked shared    | `RELEASE_SHARED` |                  | `REQUIRES_SHARED` |
|

If more people stumble into the issue, another approach would be possible. My understanding is that the order of attributes is preserved. So we could treat `ACQUIRE(m) RELEASE(m)` = `EXCLUDES(m)` differently than `RELEASE(m) ACQUIRE(m)` = `REQUIRES(m)`. But I'm not sure if that's desirable, since normally the order of attributes does not matter.


Repository:
  rC Clang

https://reviews.llvm.org/D49355





More information about the cfe-commits mailing list