Skip to content

Commit 37961ec

Browse files
Treehugger RobotGerrit Code Review
authored andcommitted
Merge "binder: replace android_atomic_add with std::atomic" into main
2 parents f006397 + a9675a7 commit 37961ec

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

libs/binder/ProcessState.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <binder/IPCThreadState.h>
2525
#include <binder/IServiceManager.h>
2626
#include <binder/Stability.h>
27-
#include <cutils/atomic.h>
2827
#include <utils/AndroidThreads.h>
2928
#include <utils/String8.h>
3029
#include <utils/Thread.h>
@@ -387,7 +386,7 @@ void ProcessState::expungeHandle(int32_t handle, IBinder* binder)
387386
}
388387

389388
String8 ProcessState::makeBinderThreadName() {
390-
int32_t s = android_atomic_add(1, &mThreadPoolSeq);
389+
int32_t s = mThreadPoolSeq.fetch_add(1, std::memory_order_release);
391390
pid_t pid = getpid();
392391

393392
std::string_view driverName = mDriverName.c_str();

libs/binder/include/binder/ProcessState.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class ProcessState : public virtual RefBase {
189189

190190
bool mForked;
191191
std::atomic_bool mThreadPoolStarted;
192-
volatile int32_t mThreadPoolSeq;
192+
std::atomic_int32_t mThreadPoolSeq;
193193

194194
CallRestriction mCallRestriction;
195195
};

0 commit comments

Comments
 (0)