am fe7c2a50: Merge change I996db8da into eclair

Merge commit 'fe7c2a50148ac9f0d6fbe0030fc53f457c10870a' into eclair-mr2

* commit 'fe7c2a50148ac9f0d6fbe0030fc53f457c10870a':
  Fix tls crash on startup if more than one RS contexts are created in one process.
This commit is contained in:
Jason Sams
2009-10-06 19:17:38 -07:00
committed by Android Git Automerger
2 changed files with 10 additions and 4 deletions

View File

@@ -304,10 +304,15 @@ Context::Context(Device *dev, Surface *sur, bool useDepth)
int status; int status;
pthread_attr_t threadAttr; pthread_attr_t threadAttr;
status = pthread_key_create(&gThreadTLSKey, NULL); if (!gThreadTLSKey) {
if (status) { status = pthread_key_create(&gThreadTLSKey, NULL);
LOGE("Failed to init thread tls key."); if (status) {
return; LOGE("Failed to init thread tls key.");
return;
}
} else {
// HACK: workaround gl hang on start
exit(-1);
} }
status = pthread_attr_init(&threadAttr); status = pthread_attr_init(&threadAttr);

View File

@@ -62,6 +62,7 @@ bool ScriptC::run(Context *rsc, uint32_t launchIndex)
{ {
Context::ScriptTLSStruct * tls = Context::ScriptTLSStruct * tls =
(Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey); (Context::ScriptTLSStruct *)pthread_getspecific(Context::gThreadTLSKey);
rsAssert(tls);
if (mEnviroment.mFragmentStore.get()) { if (mEnviroment.mFragmentStore.get()) {
rsc->setFragmentStore(mEnviroment.mFragmentStore.get()); rsc->setFragmentStore(mEnviroment.mFragmentStore.get());