diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-03-04 15:31:59 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-03-04 17:17:36 +0100 |
commit | 931996e61be61246f5d0c84f0c6caf314d3ef79f (patch) | |
tree | f9754a46c614b0436eb6d92a869754fe14547968 /sal/qa | |
parent | 9013ee1a00502b891637fe050f1c133b36d6d151 (diff) |
Avoid "ThreadSanitizer: unlock of an unlocked mutex"
...in (somewhat contorted) test code
Change-Id: I247a30e580b3d458eb748a833100a662c9890d99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130991
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal/qa')
-rw-r--r-- | sal/qa/osl/mutex/osl_Mutex.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx index c345ae33eb2b..3424bca07b3c 100644 --- a/sal/qa/osl/mutex/osl_Mutex.cxx +++ b/sal/qa/osl/mutex/osl_Mutex.cxx @@ -807,6 +807,8 @@ namespace osl_ResettableGuard CPPUNIT_ASSERT_MESSAGE("ResettableMutexGuard constructor, test the acquire operation when initialized.", bRes); + + aMutex.acquire(); } void ctor_002( ) @@ -821,6 +823,8 @@ namespace osl_ResettableGuard CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard constructor, test the acquire operation when initialized, we use reference constructor this time.", bRes); + + aMutex.acquire(); } CPPUNIT_TEST_SUITE(ctor); @@ -853,6 +857,8 @@ namespace osl_ResettableGuard bRes ); CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset", bRes1 ); + + aMutex.acquire(); } #ifdef LINUX @@ -863,6 +869,7 @@ namespace osl_ResettableGuard /// shouldn't release after clear; myMutexGuard.clear( ); + aMutex.acquire(); bool bRes = aMutex.release( ); /// can release after reset. @@ -870,9 +877,11 @@ namespace osl_ResettableGuard bool bRes1 = aMutex.release( ); CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset, release after clear and reset, on Solaris, the mutex can be release without acquire, so it can not passed on (SOLARIS), but not the reason for reset_002", - !bRes ); + bRes ); CPPUNIT_ASSERT_MESSAGE( "ResettableMutexGuard method: reset, release after clear and reset, on Solaris, the mutex can be release without acquire, so it can not passed on (SOLARIS), but not the reason for reset_002", bRes1 ); + + aMutex.acquire(); } #endif |