summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-07-23 14:54:04 -0700
committerJohn Reck <jreck@google.com>2014-07-23 22:28:44 +0000
commit73b7a4db4116774156fda3a510cc3afa14be9ffd (patch)
tree928ca1b91bd9e5e8d88ce58069a6d0027d37f965 /libs/hwui/renderthread/RenderThread.cpp
parentdf8f55948a20a0f1673274ea904eeaf8031c7d57 (diff)
Dump RenderThread stack on unresponsive
Bug: 16408405 Change-Id: I4ba4836fd1451fb8ba77c34cdb843d3cb4217bb8
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 03e98d5b2f03..32dc46ee57eb 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -20,6 +20,7 @@
#include <gui/DisplayEventReceiver.h>
#include <utils/Log.h>
+#include <pthread.h>
#include "../RenderState.h"
#include "CanvasContext.h"
@@ -136,6 +137,7 @@ public:
};
RenderThread::RenderThread() : Thread(true), Singleton<RenderThread>()
+ , mThreadId(0)
, mNextWakeup(LLONG_MAX)
, mDisplayEventReceiver(0)
, mVsyncRequested(false)
@@ -244,6 +246,7 @@ void RenderThread::requestVsync() {
}
bool RenderThread::threadLoop() {
+ mThreadId = pthread_self();
initThreadLocals();
int timeoutMillis = -1;
@@ -289,6 +292,16 @@ void RenderThread::queue(RenderTask* task) {
}
}
+void RenderThread::queueAndWait(RenderTask* task, Condition& signal, Mutex& lock) {
+ static nsecs_t sTimeout = milliseconds(500);
+ queue(task);
+ status_t err = signal.waitRelative(lock, sTimeout);
+ if (CC_UNLIKELY(err != NO_ERROR)) {
+ ALOGE("Timeout waiting for RenderTherad! err=%d", err);
+ nukeFromOrbit();
+ }
+}
+
void RenderThread::queueAtFront(RenderTask* task) {
AutoMutex _lock(mLock);
mQueue.queueAtFront(task);
@@ -341,6 +354,10 @@ RenderTask* RenderThread::nextTask(nsecs_t* nextWakeup) {
return next;
}
+void RenderThread::nukeFromOrbit() {
+ pthread_kill(mThreadId, SIGABRT);
+}
+
} /* namespace renderthread */
} /* namespace uirenderer */
} /* namespace android */