Replace spins with proper pthread conditions.
diff --git a/rsContext.cpp b/rsContext.cpp
index 7248ecc..2a5f65d 100644
--- a/rsContext.cpp
+++ b/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);
          }