diff options
author | 2024-08-05 14:21:53 -0700 | |
---|---|---|
committer | 2024-08-05 14:24:13 -0700 | |
commit | a9675a709702861f4e85783b9c26268e4c2b9b3b (patch) | |
tree | c86c6cf56814e056f93b8f9974177fe6ce046943 | |
parent | 908b09ce78edc6a3403d152f9f350077a3007dae (diff) |
binder: replace android_atomic_add with std::atomic
android_atomic_add uses the STL atomics internally with
`memory_order_release`, so this should be a no-op.
Test: m
Change-Id: Ie63464d9cb607957c0b318e9cb8f778ce1aa6d83
-rw-r--r-- | libs/binder/ProcessState.cpp | 3 | ||||
-rw-r--r-- | libs/binder/include/binder/ProcessState.h | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 7c29dba2d0..c2e0937911 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -24,7 +24,6 @@ #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <binder/Stability.h> -#include <cutils/atomic.h> #include <utils/AndroidThreads.h> #include <utils/String8.h> #include <utils/Thread.h> @@ -387,7 +386,7 @@ void ProcessState::expungeHandle(int32_t handle, IBinder* binder) } String8 ProcessState::makeBinderThreadName() { - int32_t s = android_atomic_add(1, &mThreadPoolSeq); + int32_t s = mThreadPoolSeq.fetch_add(1, std::memory_order_release); pid_t pid = getpid(); std::string_view driverName = mDriverName.c_str(); diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h index ffa222907a..ccc2d2e5e7 100644 --- a/libs/binder/include/binder/ProcessState.h +++ b/libs/binder/include/binder/ProcessState.h @@ -189,7 +189,7 @@ private: bool mForked; std::atomic_bool mThreadPoolStarted; - volatile int32_t mThreadPoolSeq; + std::atomic_int32_t mThreadPoolSeq; CallRestriction mCallRestriction; }; |