summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/rs/rsContext.cpp')
-rw-r--r--libs/rs/rsContext.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index cfd6479..4752b35 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -282,14 +282,14 @@ void * Context::threadProc(void *vrsc)
rsc->props.mLogShadersUniforms = getProp("debug.rs.shader.uniforms");
rsc->props.mLogVisual = getProp("debug.rs.visual");
- ScriptTLSStruct *tlsStruct = new ScriptTLSStruct;
- if (!tlsStruct) {
+ rsc->mTlsStruct = new ScriptTLSStruct;
+ if (!rsc->mTlsStruct) {
LOGE("Error allocating tls storage");
return NULL;
}
- tlsStruct->mContext = rsc;
- tlsStruct->mScript = NULL;
- int status = pthread_setspecific(rsc->gThreadTLSKey, tlsStruct);
+ rsc->mTlsStruct->mContext = rsc;
+ rsc->mTlsStruct->mScript = NULL;
+ int status = pthread_setspecific(rsc->gThreadTLSKey, rsc->mTlsStruct);
if (status) {
LOGE("pthread_setspecific %i", status);
}
@@ -361,6 +361,7 @@ void * Context::threadProc(void *vrsc)
rsc->deinitEGL();
pthread_mutex_unlock(&gInitMutex);
}
+ delete rsc->mTlsStruct;
LOGV("%p, RS Thread exited", rsc);
return NULL;
@@ -387,6 +388,11 @@ void * Context::helperThreadProc(void *vrsc)
#endif
setpriority(PRIO_PROCESS, rsc->mWorkers.mNativeThreadId[idx], rsc->mThreadPriority);
+ int status = pthread_setspecific(rsc->gThreadTLSKey, rsc->mTlsStruct);
+ if (status) {
+ LOGE("pthread_setspecific %i", status);
+ }
+
while(rsc->mRunning) {
rsc->mWorkers.mLaunchSignals[idx].wait();
if (rsc->mWorkers.mLaunchCallback) {