diff options
author | 2022-06-01 15:30:19 +0000 | |
---|---|---|
committer | 2022-06-01 15:30:19 +0000 | |
commit | 1d06201d05a6aed017413c6db58e2d9bc7c2078e (patch) | |
tree | e7d8b9fdf6c59195d983626435e4fa511f967a52 /libs/binder/ProcessState.cpp | |
parent | f967183ebc2c97231a831eeda9e4ba83e625c44c (diff) | |
parent | c2f5a7eeb154821ab2b26ac86b91c26b44929c16 (diff) |
Merge "Fix for flaky test in binderLibTest"
Diffstat (limited to 'libs/binder/ProcessState.cpp')
-rw-r--r-- | libs/binder/ProcessState.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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 <errno.h> #include <fcntl.h> -#include <mutex> +#include <pthread.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> +#include <unistd.h> +#include <mutex> #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<Thread> t = sp<PoolThread>::make(isMain); t->run(name.string()); + pthread_mutex_lock(&mThreadCountLock); mKernelStartedThreads++; + pthread_mutex_unlock(&mThreadCountLock); } } |