From c2f5a7eeb154821ab2b26ac86b91c26b44929c16 Mon Sep 17 00:00:00 2001 From: Elie Kheirallah Date: Fri, 27 May 2022 22:43:40 +0000 Subject: Fix for flaky test in binderLibTest Added thread locks around the update of mKernelStartedThreads Added hwasan-presubmit to TEST MAPPING Bug: 233787404 Test: binderLibTest Change-Id: If8dcd7061c478a3ebbb0414c4fcce2a9bf512563 --- libs/binder/ProcessState.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libs/binder/ProcessState.cpp') diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 6beab43117..7faff47627 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -35,14 +35,15 @@ #include #include -#include +#include #include #include -#include #include #include #include #include +#include +#include #define BINDER_VM_SIZE ((1 * 1024 * 1024) - sysconf(_SC_PAGE_SIZE) * 2) #define DEFAULT_MAX_BINDER_THREADS 15 @@ -399,7 +400,9 @@ void ProcessState::spawnPooledThread(bool isMain) ALOGV("Spawning new pooled thread, name=%s\n", name.string()); sp t = sp::make(isMain); t->run(name.string()); + pthread_mutex_lock(&mThreadCountLock); mKernelStartedThreads++; + pthread_mutex_unlock(&mThreadCountLock); } } -- cgit v1.2.3-59-g8ed1b