summaryrefslogtreecommitdiffstats
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
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 03e98d5..32dc46e 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 */