OSDN Git Service

Unlock effect chains in the middle of two if's
authorGlenn Kasten <gkasten@google.com>
Fri, 24 Feb 2012 19:20:09 +0000 (11:20 -0800)
committerGlenn Kasten <gkasten@google.com>
Fri, 24 Feb 2012 23:55:08 +0000 (15:55 -0800)
commit04743e99e71c0da012508c7119f414027654ee94
tree01efb09ba3b56687256ad81564092c7f92d9186f
parentd6fd85a157ce2054b2304e6d171fa87ae09c363d
Unlock effect chains in the middle of two if's

As part of the upcoming threadLoop() merge, this CL makes it clearer
what are the similar and different parts before and after unlocking
effect chains.

In each threadLoop(), the old code was:

    if (sleepTime == 0) {
        // A
        unlockEffectChains(effectChains);
        // B
    } else {
        unlockEffectChains(effectChains);
        // C
    }

The new code is:

    if (sleepTime == 0) {
        // A
    }
    unlockEffectChains(effectChains);
    if (sleepTime == 0) {
        // B
    } else {
        // C
    }

Also this is slightly slower by one "if", it has the advantage of making
it much more obvious about what is done before and after the unlock,
and also to see the similarities and differences among the various
copies of threadLoop().

Change-Id: I7bf4369d2dcb072573ec43b7e52c637f0097dc00
services/audioflinger/AudioFlinger.cpp