Implement OOB destroy method that can be called from the java finalizer removing the need to explicitly destroy objects.
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 3d17298..52901b2 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -118,6 +118,7 @@
ThreadIO mIO;
+ void objDestroyAdd(ObjectBase *);
protected:
Device *mDev;
@@ -142,6 +143,17 @@
ObjectBaseRef<ProgramVertex> mVertex;
ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
+
+ struct ObjDestroyOOB {
+ pthread_mutex_t mMutex;
+ Vector<ObjectBase *> mDestroyList;
+ bool mNeedToEmpty;
+ };
+ ObjDestroyOOB mObjDestroy;
+ bool objDestroyOOBInit();
+ void objDestroyOOBRun();
+ void objDestroyOOBDestroy();
+
private:
Context();