summaryrefslogtreecommitdiffstats
path: root/libs/binder
diff options
context:
space:
mode:
Diffstat (limited to 'libs/binder')
-rw-r--r--libs/binder/Binder.cpp10
-rw-r--r--libs/binder/IInterface.cpp4
-rw-r--r--libs/binder/IPCThreadState.cpp2
3 files changed, 12 insertions, 4 deletions
diff --git a/libs/binder/Binder.cpp b/libs/binder/Binder.cpp
index 2554351..296a98b 100644
--- a/libs/binder/Binder.cpp
+++ b/libs/binder/Binder.cpp
@@ -160,10 +160,18 @@ void BBinder::attachObject(
e->mObjects.attach(objectID, object, cleanupCookie, func);
}
+// The C11 standard doesn't allow atomic loads from const fields,
+// though C++11 does. Fudge it until standards get straightened out.
+static inline uintptr_t load_const_atomic(const atomic_uintptr_t* p,
+ memory_order mo) {
+ atomic_uintptr_t* non_const_p = const_cast<atomic_uintptr_t*>(p);
+ return atomic_load_explicit(non_const_p, mo);
+}
+
void* BBinder::findObject(const void* objectID) const
{
Extras* e = reinterpret_cast<Extras*>(
- atomic_load_explicit(&mExtras, memory_order_acquire));
+ load_const_atomic(&mExtras, memory_order_acquire));
if (!e) return NULL;
AutoMutex _l(e->mLock);
diff --git a/libs/binder/IInterface.cpp b/libs/binder/IInterface.cpp
index 29acf5d..99a9ffe 100644
--- a/libs/binder/IInterface.cpp
+++ b/libs/binder/IInterface.cpp
@@ -29,12 +29,12 @@ IInterface::~IInterface() {
sp<IBinder> IInterface::asBinder()
{
- return this ? onAsBinder() : NULL;
+ return onAsBinder();
}
sp<const IBinder> IInterface::asBinder() const
{
- return this ? const_cast<IInterface*>(this)->onAsBinder() : NULL;
+ return const_cast<IInterface*>(this)->onAsBinder();
}
// ---------------------------------------------------------------------------
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index dd04dcf..442b92c 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -682,7 +682,7 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy)
IPCThreadState::IPCThreadState()
: mProcess(ProcessState::self()),
- mMyThreadId(androidGetTid()),
+ mMyThreadId(gettid()),
mStrictModePolicy(0),
mLastTransactionBinderFlags(0)
{