Add error check when init RS thread in sync mode.
RS should return false and stop further waiting when it failed to init RS thread,
otherwise it will cause RS caller ANR errors.
Update destructor function for the exception handling accordingly.
Change-Id: I80a946e6be6b23cc93388b5f56d58ad6dc809d8b
Signed-off-by: Xiaofei Wan <xiaofei.wan@intel.com>
diff --git a/rsContext.cpp b/rsContext.cpp
index 1bcea6b..ef77685 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -580,6 +580,11 @@
timerSet(RS_TIMER_INTERNAL);
if (mSynchronous) {
threadProc(this);
+
+ if (mError != RS_ERROR_NONE) {
+ ALOGE("Errors during thread init (sync mode)");
+ return false;
+ }
} else {
status = pthread_create(&mThreadId, &threadAttr, threadProc, this);
if (status) {
@@ -611,7 +616,7 @@
int status = pthread_join(mThreadId, &res);
rsAssert(mExit);
- if (mHal.funcs.shutdownDriver) {
+ if (mHal.funcs.shutdownDriver && mHal.drv) {
mHal.funcs.shutdownDriver(this);
}