diff options
| author | Mikhail Naganov <mnaganov@google.com> | 2019-03-29 11:13:11 -0700 |
|---|---|---|
| committer | Mikhail Naganov <mnaganov@google.com> | 2019-03-29 12:21:57 -0700 |
| commit | 45ef2e73263bc0e2427e8422cb0afbf20e7b19f6 (patch) | |
| tree | be48320b09d3bb9864e3beae5251ce1e516745da /libutils/Mutex_test.cpp | |
| parent | 06c9a21030669ff8e5a7b31aaa8ddaf900952c2d (diff) | |
libutils: Fix thread safety annotations in Mutex
The annotations for Mutex::tryLock and timedLock were
incorrectly specifying the return value for the successful
acquisition.
Test: make libutils_test
Change-Id: I9729b6555ede5cb1d6db046e33c35bf5926c7755
Diffstat (limited to 'libutils/Mutex_test.cpp')
| -rw-r--r-- | libutils/Mutex_test.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libutils/Mutex_test.cpp b/libutils/Mutex_test.cpp index 8a1805f51d..79f4302d0d 100644 --- a/libutils/Mutex_test.cpp +++ b/libutils/Mutex_test.cpp @@ -29,4 +29,20 @@ TEST(Mutex, compile) { android::Mutex::Autolock _l(mLock); i = 0; modifyLockedVariable(); -}
\ No newline at end of file +} + +TEST(Mutex, tryLock) { + if (mLock.tryLock() != 0) { + return; + } + mLock.unlock(); +} + +#if defined(__ANDROID__) +TEST(Mutex, timedLock) { + if (mLock.timedLock(1) != 0) { + return; + } + mLock.unlock(); +} +#endif |
