Replace spins with proper pthread conditions.
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 7248ecc..2a5f65d 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -130,14 +130,10 @@
rsc->mRunning = true;
bool mDraw = true;
while (!rsc->mExit) {
- mDraw |= gIO->playCoreCommands(rsc);
+ mDraw |= gIO->playCoreCommands(rsc, !mDraw);
+ mDraw &= (rsc->mRootScript.get() != NULL);
- if (!mDraw || !rsc->mRootScript.get()) {
- usleep(10000);
- continue;
- }
-
- if (rsc->mRootScript.get()) {
+ if (mDraw) {
mDraw = rsc->runRootScript();
eglSwapBuffers(rsc->mDisplay, rsc->mSurface);
}