am 887a834c: Merge "Attempt to fix 3333866 Missing memory barrier when the non-locking past path is hit." into honeycomb

* commit '887a834c4737bed055bacbc91cc0dd42bd25546c':
  Attempt to fix 3333866 Missing memory barrier when the non-locking past path is hit.
This commit is contained in:
Jason Sams
2011-01-25 00:26:14 -08:00
committed by Android Git Automerger

View File

@@ -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();
}