summaryrefslogtreecommitdiffstats
path: root/include/private
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-04-27 16:11:38 -0700
committerMathias Agopian <mathias@google.com>2010-04-28 16:12:54 -0700
commitc54c12713b98f308f848d2eb9ed7ef28ecc62c55 (patch)
treecee4c74a6421cd6b128ed3c2538c836469c6ba06 /include/private
parent3fd6419fe542c4ecb8e838d1754a83ce8591b288 (diff)
downloadframeworks_base-c54c12713b98f308f848d2eb9ed7ef28ecc62c55.zip
frameworks_base-c54c12713b98f308f848d2eb9ed7ef28ecc62c55.tar.gz
frameworks_base-c54c12713b98f308f848d2eb9ed7ef28ecc62c55.tar.bz2
fix a race condition in undoDequeue(), where 'tail' could be computed incorrectly.
in the undoDequeue() case, 'tail' was recalculated from 'available' and 'head' however there was a race between this and retireAndLock(), which could cause 'tail' to be recalculated wrongly. the interesting thing though is that retireAndLock() shouldn't have any impact on the value of 'tail', which is client-side only attribute. we fix the race by saving the value of 'tail' before dequeue() and restore it in the case of undoDequeue(), since we know it doesn't depend on retireAndLock(). Change-Id: I4bcc4d16b6bc4dd93717ee739c603040b18295a0
Diffstat (limited to 'include/private')
-rw-r--r--include/private/surfaceflinger/SharedBufferStack.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/private/surfaceflinger/SharedBufferStack.h b/include/private/surfaceflinger/SharedBufferStack.h
index 6ace5bc..39ef3a1 100644
--- a/include/private/surfaceflinger/SharedBufferStack.h
+++ b/include/private/surfaceflinger/SharedBufferStack.h
@@ -167,6 +167,7 @@ protected:
SharedBufferStack* const mSharedStack;
const int mNumBuffers;
const int mIdentity;
+ int32_t computeTail() const;
friend struct Update;
friend struct QueueUpdate;
@@ -259,8 +260,6 @@ private:
friend struct Condition;
friend struct DequeueCondition;
friend struct LockCondition;
-
- int32_t computeTail() const;
struct QueueUpdate : public UpdateBase {
inline QueueUpdate(SharedBufferBase* sbb);
@@ -288,6 +287,7 @@ private:
};
int32_t tail;
+ int32_t undoDequeueTail;
// statistics...
nsecs_t mDequeueTime[NUM_BUFFER_MAX];
};