Fix tls crash on startup if more than one RS contexts are created in one process.
diff --git a/rsContext.cpp b/rsContext.cpp
index a1e9e45..195ea6f 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -304,10 +304,15 @@
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);