Merge commit '12bb2c4c6d73c5b9e531ba852fb6260bb8b87411' into eclair-mr2-plus-aosp * commit '12bb2c4c6d73c5b9e531ba852fb6260bb8b87411': Fix tls crash on startup if more than one RS contexts are created in one process.
This commit is contained in:
@@ -304,10 +304,15 @@ Context::Context(Device *dev, Surface *sur, bool useDepth)
|
||||
int status;
|
||||
pthread_attr_t threadAttr;
|
||||
|
||||
status = pthread_key_create(&gThreadTLSKey, NULL);
|
||||
if (status) {
|
||||
LOGE("Failed to init thread tls key.");
|
||||
return;
|
||||
if (!gThreadTLSKey) {
|
||||
status = pthread_key_create(&gThreadTLSKey, NULL);
|
||||
if (status) {
|
||||
LOGE("Failed to init thread tls key.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// HACK: workaround gl hang on start
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
status = pthread_attr_init(&threadAttr);
|
||||
|
||||
@@ -62,6 +62,7 @@ bool ScriptC::run(Context *rsc, uint32_t launchIndex)
|
||||
{
|
||||
Context::ScriptTLSStruct * tls =
|
||||
(Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey);
|
||||
rsAssert(tls);
|
||||
|
||||
if (mEnviroment.mFragmentStore.get()) {
|
||||
rsc->setFragmentStore(mEnviroment.mFragmentStore.get());
|
||||
|
||||
Reference in New Issue
Block a user