summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-02 02:22:21 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-12-02 02:22:21 +0000
commit62978d0078e0978d1b50d0fa975c52000200d111 (patch)
treea3774c4b0a8dcd552b465c640daf9e252692c61f
parentf24a815d93e0bb0df228c7ce2e4437710fe51570 (diff)
parente3c586218ac418e872954b56eae1c9bf597fa541 (diff)
downloadminikin-62978d0078e0978d1b50d0fa975c52000200d111.tar.gz
Snap for 9358895 from e3c586218ac418e872954b56eae1c9bf597fa541 to udc-release
Change-Id: I4d0c5ec6148434347a76dd17ba15415522f34226
-rw-r--r--tests/stresstest/MultithreadTest.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/stresstest/MultithreadTest.cpp b/tests/stresstest/MultithreadTest.cpp
index 560b517..d32d0b4 100644
--- a/tests/stresstest/MultithreadTest.cpp
+++ b/tests/stresstest/MultithreadTest.cpp
@@ -21,17 +21,19 @@
#include <random>
#include <thread>
+#include <android-base/thread_annotations.h>
#include <cutils/log.h>
#include <gtest/gtest.h>
#include "minikin/FontCollection.h"
#include "minikin/Macros.h"
#include "minikin/MinikinPaint.h"
-
#include "FontTestUtils.h"
#include "MinikinInternal.h"
#include "PathUtils.h"
+using android::base::ScopedLockAssertion;
+
namespace minikin {
constexpr int LAYOUT_COUNT_PER_COLLECTION = 500;
@@ -63,7 +65,7 @@ static void thread_main(int tid) {
{
// Wait until all threads are created.
std::unique_lock<std::mutex> lock(gMutex);
- gCv.wait(lock, [] { return gReady; });
+ gCv.wait(lock, []() EXCLUSIVE_LOCKS_REQUIRED(gMutex) { return gReady; });
}
std::mt19937 mt(tid);
@@ -90,7 +92,7 @@ TEST(MultithreadTest, ThreadSafeStressTest) {
std::vector<std::thread> threads;
{
- std::unique_lock<std::mutex> lock(gMutex);
+ ScopedLockAssertion lock(gMutex);
threads.reserve(NUM_THREADS);
for (int i = 0; i < NUM_THREADS; ++i) {
threads.emplace_back(&thread_main, i);