diff options
author | Miao Wang <miaowang@google.com> | 2017-05-15 17:05:12 -0700 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2017-05-15 18:14:40 -0700 |
commit | 520ddb785d32fef23039aa1b751ab40dc0d98eeb (patch) | |
tree | 4481e0f45ea977ce8d9d6f0f045898be363519fe | |
parent | 03ecfa26d472f298deddbe8dc08549abe17a793f (diff) | |
download | rs-520ddb785d32fef23039aa1b751ab40dc0d98eeb.tar.gz |
Only try to join the pthread when it is successfully initialized.
- When Context::initContext fail to initialize a pthread, it tries to
join a invalid pthread in Context::~Context(), in certain
circumstances.
- This CL uses the Context::mRunning as an indicator of whether the
pthread is successfully initialized, and only join it when mRunning is
true.
Bug: 38322462
Test: mm, boot sailfish, and CTS tests pass.
Change-Id: I44525907b213a83a0654c731877c3277de249f24
-rw-r--r-- | rsContext.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rsContext.cpp b/rsContext.cpp index aab065c7..cc6f6de8 100644 --- a/rsContext.cpp +++ b/rsContext.cpp @@ -554,7 +554,10 @@ Context::~Context() { void *res; mIO.shutdown(); - if (!mSynchronous) { + if (!mSynchronous && mRunning) { + // Only try to join a pthread when: + // 1. The Context is asynchronous. + // 2. pthread successfully created and running. pthread_join(mThreadId, &res); } rsAssert(mExit); |