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

Commit fcecc244 authored by Jason Sams's avatar Jason Sams
Browse files

Attempt to fix 3333866

Missing memory barrier when the non-locking past
path is hit.

Change-Id: I80db7df547c1ce35ed85ba117519b12679cc42ef
parent c55de66a
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();
    }