[cfe-dev] thread-safety warnings, specifically try_acquire_capability

Roman Lebedev via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 18 01:45:08 PST 2018


On Thu, Jan 18, 2018 at 12:36 PM, Bruce Stephens via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> I'm trying to use the annotations on some existing code, with (I
> think) success, mostly. There's some code that conditionally locks
> mutexes, and I note that's not supported so some code reorganisation
> was needed.
>
> What I can't seem to get to work is trylock(). I have some code which
> does something like
>
>     if (!mutex_.trylock()) {
>        return;
>     }
>     ...
>     mutex_.unlock();
>
> and that doesn't work at all. I always seem to get complaints that
> mutex_ might not be locked. Is this just an extension of the
> unsupported nature of conditional locking? i.e., is there currently no
> useful way to use the try_acquire_capability attribute (beyond
> documentation)? (Not a horrible restriction for this code, but I'd
> have thought it would be useful to mention it in the docs.)
I believe i have reported the same bug already:
https://bugs.llvm.org/show_bug.cgi?id=32954

Roman.

> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list