diff options
Diffstat (limited to 'rs')
| -rw-r--r-- | rs/java/android/renderscript/RenderScript.java | 18 | ||||
| -rw-r--r-- | rs/jni/android_renderscript_RenderScript.cpp | 8 |
2 files changed, 19 insertions, 7 deletions
diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 8b1a032..4440417 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -1557,9 +1557,21 @@ public class RenderScript { nContextDeinitToClient(mContext); mMessageThread.mRun = false; - try { - mMessageThread.join(); - } catch(InterruptedException e) { + + // Wait for mMessageThread to join. Try in a loop, in case this thread gets interrupted + // during the wait. If interrupted, set the "interrupted" status of the current thread. + boolean hasJoined = false, interrupted = false; + while (!hasJoined) { + try { + mMessageThread.join(); + hasJoined = true; + } catch (InterruptedException e) { + interrupted = true; + } + } + if (interrupted) { + Log.v(LOG_TAG, "Interrupted during wait for MessageThread to join"); + Thread.currentThread().interrupt(); } nContextDestroy(); diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp index ffc4fd8..2bc48e4 100644 --- a/rs/jni/android_renderscript_RenderScript.cpp +++ b/rs/jni/android_renderscript_RenderScript.cpp @@ -611,7 +611,7 @@ nScriptIntrinsicBLAS_Double(JNIEnv *_env, jobject _this, jlong con, jlong id, ji in_allocs[2] = (RsAllocation)C; rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, - in_allocs, sizeof(in_allocs), nullptr, + in_allocs, NELEM(in_allocs), nullptr, &call, sizeof(call), nullptr, 0); } @@ -646,7 +646,7 @@ nScriptIntrinsicBLAS_Complex(JNIEnv *_env, jobject _this, jlong con, jlong id, j in_allocs[2] = (RsAllocation)C; rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, - in_allocs, sizeof(in_allocs), nullptr, + in_allocs, NELEM(in_allocs), nullptr, &call, sizeof(call), nullptr, 0); } @@ -681,7 +681,7 @@ nScriptIntrinsicBLAS_Z(JNIEnv *_env, jobject _this, jlong con, jlong id, jint fu in_allocs[2] = (RsAllocation)C; rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, - in_allocs, sizeof(in_allocs), nullptr, + in_allocs, NELEM(in_allocs), nullptr, &call, sizeof(call), nullptr, 0); } @@ -707,7 +707,7 @@ nScriptIntrinsicBLAS_BNNM(JNIEnv *_env, jobject _this, jlong con, jlong id, jint in_allocs[2] = (RsAllocation)C; rsScriptForEachMulti((RsContext)con, (RsScript)id, 0, - in_allocs, sizeof(in_allocs), nullptr, + in_allocs, NELEM(in_allocs), nullptr, &call, sizeof(call), nullptr, 0); } |
