<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 11/5/2021 6:56 PM, Aaron Puchert
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:b43ef801-4e84-e0ad-4a78-84a842202751@alice-dsl.net">Am
05.11.21 um 05:32 schrieb Randell Jesup:
<br>
<blockquote type="cite">
<br>
I presume support for an RAII unlocker isn't likely soon.
<br>
<br>
</blockquote>
We support that since <a class="moz-txt-link-freetext" href="https://reviews.llvm.org/D52578">https://reviews.llvm.org/D52578</a>. (See the
tests for how to use it.)
<br>
<br>
Interestingly that was actually requested by your friendly
competitors at Chromium
(<a class="moz-txt-link-freetext" href="https://bugs.llvm.org/show_bug.cgi?id=36162">https://bugs.llvm.org/show_bug.cgi?id=36162</a>), but unless I'm
missing something, they're not using it yet.
</blockquote>
<p><br>
</p>
<p>I've tried this.... it works better than without it, but there
are some oddities:</p>
<p>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)<br>
</p>
<p>I still get a warning that "mutex 'mMutex' is still held at the
end of function" if I have:</p>
<p>void foo() {</p>
<p> mMutex.AssertCurrentThreadOwns(); // where
AssertCurrentThreadOwns() has ASSERT_EXCLUSIVE_LOCK(this)</p>
<p> ....</p>
<p> {</p>
<p> MutexAutoUnlock unlock(mMutex);</p>
<p> ....</p>
<p> }</p>
<p> ....</p>
<p>} <br>
</p>
<p><br>
</p>
<p>Thanks for any help,</p>
<p> Randell Jesup, Mozilla<br>
</p>
<p>}<br>
</p>
</body>
</html>