Remove global IO context and integrate it into the RS context.
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 2860452..52389ea 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -84,11 +84,6 @@
bool Context::runRootScript()
{
-#if RS_LOG_TIMES
- struct timespec beginTime;
- clock_gettime(CLOCK_MONOTONIC, &beginTime);
-#endif
-
rsAssert(mRootScript->mEnviroment.mIsRoot);
//glColor4f(1,1,1,1);
@@ -116,9 +111,10 @@
struct timespec endTime;
clock_gettime(CLOCK_MONOTONIC, &endTime);
- int t1 = ((unsigned long)startTime.tv_nsec - (unsigned long)beginTime.tv_nsec) / 1000 / 1000;
- int t2 = ((unsigned long)endTime.tv_nsec - (unsigned long)startTime.tv_nsec) / 1000 / 1000;
- LOGE("times %i, %i", t1, t2);
+ uint64_t t1 = endTime.tv_nsec + ((uint64_t)endTime.tv_sec * 1000 * 1000 * 1000);
+ uint64_t t2 = startTime.tv_nsec + ((uint64_t)startTime.tv_sec * 1000 * 1000 * 1000);
+ int t3 = (int)((t1 - t2) / 1000 / 1000);
+ LOGE("times %i", t3);
#endif
return ret;
@@ -143,7 +139,6 @@
{
Context *rsc = static_cast<Context *>(vrsc);
- gIO = new ThreadIO();
rsc->initEGL();
ScriptTLSStruct *tlsStruct = new ScriptTLSStruct;
@@ -168,7 +163,7 @@
rsc->mRunning = true;
bool mDraw = true;
while (!rsc->mExit) {
- mDraw |= gIO->playCoreCommands(rsc, !mDraw);
+ mDraw |= rsc->mIO.playCoreCommands(rsc, !mDraw);
mDraw &= (rsc->mRootScript.get() != NULL);
if (mDraw) {