summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-10-07 11:59:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2009-10-07 11:59:20 -0700
commit36802f819d0db72e44bc254bec50faeabb46b057 (patch)
treec13084c8d68697761cdf72f7345278e39317176a
parent15097318640591f9e582dbdd57ec0e9d97a7683e (diff)
parentfe7c2a50148ac9f0d6fbe0030fc53f457c10870a (diff)
downloadframeworks_base-36802f819d0db72e44bc254bec50faeabb46b057.zip
frameworks_base-36802f819d0db72e44bc254bec50faeabb46b057.tar.gz
frameworks_base-36802f819d0db72e44bc254bec50faeabb46b057.tar.bz2
am fe7c2a50: Merge change I996db8da into eclair
Merge commit 'fe7c2a50148ac9f0d6fbe0030fc53f457c10870a' into eclair-plus-aosp * commit 'fe7c2a50148ac9f0d6fbe0030fc53f457c10870a': Fix tls crash on startup if more than one RS contexts are created in one process.
-rw-r--r--libs/rs/rsContext.cpp13
-rw-r--r--libs/rs/rsScriptC.cpp1
2 files changed, 10 insertions, 4 deletions
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index a1e9e45..195ea6f 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -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);
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 20088da..9da7766 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -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());