Merge "Binder: Add log output in IPCThreadState::self()" am: 2be113a248 am: e7ae3b1962
am: 35cadd735a
* commit '35cadd735aa3db14e82e7d492f7f7d64357e915a':
Binder: Add log output in IPCThreadState::self()
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index a237684..1f6bda2 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -287,12 +287,18 @@
return new IPCThreadState;
}
- if (gShutdown) return NULL;
+ if (gShutdown) {
+ ALOGW("Calling IPCThreadState::self() during shutdown is dangerous, expect a crash.\n");
+ return NULL;
+ }
pthread_mutex_lock(&gTLSMutex);
if (!gHaveTLS) {
- if (pthread_key_create(&gTLS, threadDestructor) != 0) {
+ int key_create_value = pthread_key_create(&gTLS, threadDestructor);
+ if (key_create_value != 0) {
pthread_mutex_unlock(&gTLSMutex);
+ ALOGW("IPCThreadState::self() unable to create TLS key, expect a crash: %s\n",
+ strerror(key_create_value));
return NULL;
}
gHaveTLS = true;