Skip to content

Commit 95482b6

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
Merge "Fix an issue where we could wait for a non-existing transaction" into ics-mr1
2 parents 59c73b9 + a06c06b commit 95482b6

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,23 +1217,25 @@ void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state,
12171217
sp<Client> client( static_cast<Client *>(s.client.get()) );
12181218
transactionFlags |= setClientStateLocked(client, s.state);
12191219
}
1220+
12201221
if (transactionFlags) {
1222+
// this triggers the transaction
12211223
setTransactionFlags(transactionFlags);
1222-
}
12231224

1224-
// if this is a synchronous transaction, wait for it to take effect before
1225-
// returning.
1226-
if (flags & eSynchronous) {
1227-
mTransationPending = true;
1228-
}
1229-
while (mTransationPending) {
1230-
status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
1231-
if (CC_UNLIKELY(err != NO_ERROR)) {
1232-
// just in case something goes wrong in SF, return to the
1233-
// called after a few seconds.
1234-
LOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
1235-
mTransationPending = false;
1236-
break;
1225+
// if this is a synchronous transaction, wait for it to take effect
1226+
// before returning.
1227+
if (flags & eSynchronous) {
1228+
mTransationPending = true;
1229+
}
1230+
while (mTransationPending) {
1231+
status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5));
1232+
if (CC_UNLIKELY(err != NO_ERROR)) {
1233+
// just in case something goes wrong in SF, return to the
1234+
// called after a few seconds.
1235+
LOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!");
1236+
mTransationPending = false;
1237+
break;
1238+
}
12371239
}
12381240
}
12391241
}

0 commit comments

Comments
 (0)