[cfe-dev] Who is working on/has worked on Capability analysis (-Wthread-safety)?
Randell Jesup via cfe-dev
cfe-dev at lists.llvm.org
Fri Nov 19 15:52:25 PST 2021
On 11/5/2021 6:56 PM, Aaron Puchert wrote:
> Am 05.11.21 um 05:32 schrieb Randell Jesup:
>>
>> I presume support for an RAII unlocker isn't likely soon.
>>
> We support that since https://reviews.llvm.org/D52578. (See the tests
> for how to use it.)
>
> Interestingly that was actually requested by your friendly competitors
> at Chromium (https://bugs.llvm.org/show_bug.cgi?id=36162), but unless
> I'm missing something, they're not using it yet.
I've tried this.... it works better than without it, but there are some
oddities:
In the test code (that's the only documentation for this?) both
MutexAutoUnLock() and ~MutexAutoUnlock() are marked as
EXCLUSIVE_UNLOCK_FUNCTION()?? But if I make ~MutexAutoUnlock()
EXCLUSIVE_LOCK_FUNCTION() (which would make sense), I get more errors.
This is at minimum confusing. Perhaps specific attributes for RAII
unlockers? (even if the #define to the same thing... though personally
I wouldn't)
I still get a warning that "mutex 'mMutex' is still held at the end of
function" if I have:
void foo() {
mMutex.AssertCurrentThreadOwns(); // where
AssertCurrentThreadOwns() has ASSERT_EXCLUSIVE_LOCK(this)
....
{
MutexAutoUnlock unlock(mMutex);
....
}
....
}
Thanks for any help,
Randell Jesup, Mozilla
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211119/3b8c055b/attachment.html>
More information about the cfe-dev
mailing list