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

Commit 887a834c authored by Jason Sams's avatar Jason Sams Committed by Android (Google) Code Review
Browse files

Merge "Attempt to fix 3333866 Missing memory barrier when the non-locking past...

Merge "Attempt to fix 3333866 Missing memory barrier when the non-locking past path is hit." into honeycomb
parents a2edecfe fcecc244
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -76,7 +76,8 @@ uint32_t LocklessCommandFifo::getFreeSpace() const {
}

bool LocklessCommandFifo::isEmpty() const {
    return mPut == mGet;
    uint32_t p = android_atomic_acquire_load((int32_t *)&mPut);
    return ((uint8_t *)p) == mGet;
}


@@ -155,7 +156,9 @@ const void * LocklessCommandFifo::get(uint32_t *command, uint32_t *bytesData) {

void LocklessCommandFifo::next() {
    uint32_t bytes = reinterpret_cast<const uint16_t *>(mGet)[1];
    mGet += ((bytes + 3) & ~3) + 4;

    android_atomic_add(((bytes + 3) & ~3) + 4, (int32_t *)&mGet);
    //mGet += ((bytes + 3) & ~3) + 4;
    if (isEmpty()) {
        mSignalToControl.set();
    }