Fix "return 0" behavior in rs
0 was not properly blocking for the next message.
Change-Id: I0d9f0a8f799ba457197920c6a699f80f496eaa8e
diff --git a/rsContext.cpp b/rsContext.cpp
index f65dd47..8996ad1 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -252,10 +252,11 @@
while (!rsc->mExit) {
uint64_t waitTime = 0;
uint64_t now = rsc->getTime();
- if (now < targetTime) {
- waitTime = targetTime - now;
- } else {
- doWait = false;
+ if (!doWait) {
+ if (now < targetTime) {
+ waitTime = targetTime - now;
+ doWait = true;
+ }
}
mDraw |= rsc->mIO.playCoreCommands(rsc, doWait, waitTime);
@@ -265,7 +266,7 @@
if (mDraw && rsc->mIsGraphicsContext) {
uint64_t delay = rsc->runRootScript() * 1000000;
targetTime = rsc->getTime() + delay;
- doWait = delay != 0;
+ doWait = (delay == 0);
if (rsc->props.mLogVisual) {
rsc->displayDebugStats();