Loading media/jni/soundpool/StreamManager.h +8 −1 Original line number Original line Diff line number Diff line Loading @@ -52,6 +52,12 @@ public: JavaThread(JavaThread &&) = delete; // uses "this" ptr, not moveable. JavaThread(JavaThread &&) = delete; // uses "this" ptr, not moveable. ~JavaThread() { join(); // manually block until the future is ready as std::future // destructor doesn't block unless it comes from std::async // and it is the last reference to shared state. } void join() const { void join() const { mFuture.wait(); mFuture.wait(); } } Loading @@ -64,8 +70,9 @@ private: static int staticFunction(void *data) { static int staticFunction(void *data) { JavaThread *jt = static_cast<JavaThread *>(data); JavaThread *jt = static_cast<JavaThread *>(data); jt->mF(); jt->mF(); jt->mIsClosed = true; jt->mPromise.set_value(); jt->mPromise.set_value(); jt->mIsClosed = true; // publicly inform that we are closed // after we have accessed all variables. return 0; return 0; } } Loading Loading
media/jni/soundpool/StreamManager.h +8 −1 Original line number Original line Diff line number Diff line Loading @@ -52,6 +52,12 @@ public: JavaThread(JavaThread &&) = delete; // uses "this" ptr, not moveable. JavaThread(JavaThread &&) = delete; // uses "this" ptr, not moveable. ~JavaThread() { join(); // manually block until the future is ready as std::future // destructor doesn't block unless it comes from std::async // and it is the last reference to shared state. } void join() const { void join() const { mFuture.wait(); mFuture.wait(); } } Loading @@ -64,8 +70,9 @@ private: static int staticFunction(void *data) { static int staticFunction(void *data) { JavaThread *jt = static_cast<JavaThread *>(data); JavaThread *jt = static_cast<JavaThread *>(data); jt->mF(); jt->mF(); jt->mIsClosed = true; jt->mPromise.set_value(); jt->mPromise.set_value(); jt->mIsClosed = true; // publicly inform that we are closed // after we have accessed all variables. return 0; return 0; } } Loading