summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2015-01-12 23:41:46 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-12 23:41:46 +0000
commit9c22ac77e41b8bbddbb64959acabce3f3a07345d (patch)
treeffa49a0ca45a12a4f8c2af6cbc58e0774c6bf57b
parenteb329c07c150dfaf539d1d48bedf1572e963348f (diff)
parent5b730570be2bd1f90346a5921d0b70dc11351396 (diff)
downloadframeworks_native-9c22ac77e41b8bbddbb64959acabce3f3a07345d.zip
frameworks_native-9c22ac77e41b8bbddbb64959acabce3f3a07345d.tar.gz
frameworks_native-9c22ac77e41b8bbddbb64959acabce3f3a07345d.tar.bz2
am 5b730570: Merge "surfaceflinger: use Mutex timedLock instead of tryLock loop"
* commit '5b730570be2bd1f90346a5921d0b70dc11351396': surfaceflinger: use Mutex timedLock instead of tryLock loop
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index fcdc1cf..3419295 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2403,18 +2403,15 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
result.appendFormat("Permission Denial: "
"can't dump SurfaceFlinger from pid=%d, uid=%d\n", pid, uid);
} else {
- // Try to get the main lock, but don't insist if we can't
+ // Try to get the main lock, but give up after one second
// (this would indicate SF is stuck, but we want to be able to
// print something in dumpsys).
- int retry = 3;
- while (mStateLock.tryLock()<0 && --retry>=0) {
- usleep(1000000);
- }
- const bool locked(retry >= 0);
+ status_t err = mStateLock.timedLock(s2ns(1));
+ bool locked = (err == NO_ERROR);
if (!locked) {
- result.append(
- "SurfaceFlinger appears to be unresponsive, "
- "dumping anyways (no locks held)\n");
+ result.appendFormat(
+ "SurfaceFlinger appears to be unresponsive (%s [%d]), "
+ "dumping anyways (no locks held)\n", strerror(-err), err);
}
bool dumpAll = true;