Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57fceab5 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "SoundPool: Fix StreamManager JavaThread shutdown" into rvc-dev am:...

Merge "SoundPool: Fix StreamManager JavaThread shutdown" into rvc-dev am: e68ae63e am: 260d0592 am: de291c93 am: 1206a125

Change-Id: Ica59595dd26982c479228e40cb26af031827bdb7
parents 97df78d8 1206a125
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -52,6 +52,12 @@ public:

    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 {
        mFuture.wait();
    }
@@ -64,8 +70,9 @@ private:
    static int staticFunction(void *data) {
        JavaThread *jt = static_cast<JavaThread *>(data);
        jt->mF();
        jt->mIsClosed = true;
        jt->mPromise.set_value();
        jt->mIsClosed = true;  // publicly inform that we are closed
                               // after we have accessed all variables.
        return 0;
    }