From e60446b9c1a0f4f48372a36de5b01a2ddb8121e3 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Thu, 24 Sep 2009 14:55:38 -0700 Subject: [PATCH] Fix invokables to make sure script pointers are setup before invoking function calls. Reduce app startup time up to 1s. --- libs/rs/java/Fountain/AndroidManifest.xml | 3 +-- libs/rs/rsContext.cpp | 2 +- libs/rs/rsLocklessFifo.cpp | 4 ++-- libs/rs/rsScript.cpp | 1 + libs/rs/rsScript.h | 1 + libs/rs/rsScriptC.cpp | 16 ++++++++++------ libs/rs/rsScriptC.h | 1 + 7 files changed, 17 insertions(+), 11 deletions(-) diff --git a/libs/rs/java/Fountain/AndroidManifest.xml b/libs/rs/java/Fountain/AndroidManifest.xml index dd0e42876f53a..118593067c11a 100644 --- a/libs/rs/java/Fountain/AndroidManifest.xml +++ b/libs/rs/java/Fountain/AndroidManifest.xml @@ -2,8 +2,7 @@ - + diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp index cc11ab271976e..0ac8320d9977b 100644 --- a/libs/rs/rsContext.cpp +++ b/libs/rs/rsContext.cpp @@ -317,7 +317,7 @@ Context::Context(Device *dev, Surface *sur, bool useDepth) } while(!mRunning) { - sleep(1); + usleep(100); } pthread_attr_destroy(&threadAttr); diff --git a/libs/rs/rsLocklessFifo.cpp b/libs/rs/rsLocklessFifo.cpp index 0c4038953d68e..f4f5d40cc1577 100644 --- a/libs/rs/rsLocklessFifo.cpp +++ b/libs/rs/rsLocklessFifo.cpp @@ -159,7 +159,7 @@ void LocklessCommandFifo::makeSpace(uint32_t bytes) if ((mPut+bytes) > mEnd) { // Need to loop regardless of where get is. while((mGet > mPut) && (mBuffer+4 >= mGet)) { - sleep(1); + usleep(100); } // Toss in a reset then the normal wait for space will do the rest. @@ -170,7 +170,7 @@ void LocklessCommandFifo::makeSpace(uint32_t bytes) // it will fit here so we just need to wait for space. while(getFreeSpace() < bytes) { - sleep(1); + usleep(100); } } diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp index 99a085d878564..76fed3b04e3c2 100644 --- a/libs/rs/rsScript.cpp +++ b/libs/rs/rsScript.cpp @@ -94,6 +94,7 @@ void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot) void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot) { Script *s = static_cast