diff options
author | Mathias Agopian <mathias@google.com> | 2012-10-09 14:38:19 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-10-09 14:38:19 -0700 |
commit | b5c9dcdf3bdab1862047060b8e18c9d1831db8bb (patch) | |
tree | 7f29502d0b3e27fcd41e7e511d813426d2369134 /libs/ui | |
parent | cb55857bbde34a06c19dde3db5064d1717a0173e (diff) | |
download | frameworks_native-b5c9dcdf3bdab1862047060b8e18c9d1831db8bb.tar.gz frameworks_native-b5c9dcdf3bdab1862047060b8e18c9d1831db8bb.tar.bz2 frameworks_native-b5c9dcdf3bdab1862047060b8e18c9d1831db8bb.zip |
Fence didn't manager sync_wait error codes properly
error codes are returned in errno, this caused ::waitForwever()
to only wait for 1 second and return improper error code (-1).
needed to help debugging 7316632
Bug: 7316632
Change-Id: Ie144f614a88393393972a3a770c6b4b0581f961a
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/Fence.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libs/ui/Fence.cpp b/libs/ui/Fence.cpp index d2dbad276..d214b9761 100644 --- a/libs/ui/Fence.cpp +++ b/libs/ui/Fence.cpp @@ -42,26 +42,27 @@ Fence::~Fence() { } } -int Fence::wait(unsigned int timeout) { +status_t Fence::wait(unsigned int timeout) { ATRACE_CALL(); if (mFenceFd == -1) { return NO_ERROR; } - return sync_wait(mFenceFd, timeout); + int err = sync_wait(mFenceFd, timeout); + return err < 0 ? -errno : status_t(NO_ERROR); } -int Fence::waitForever(unsigned int warningTimeout, const char* logname) { +status_t Fence::waitForever(unsigned int warningTimeout, const char* logname) { ATRACE_CALL(); if (mFenceFd == -1) { return NO_ERROR; } int err = sync_wait(mFenceFd, warningTimeout); - if (err == -ETIME) { + if (err < 0 && errno == ETIME) { ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd, warningTimeout); err = sync_wait(mFenceFd, TIMEOUT_NEVER); } - return err; + return err < 0 ? -errno : status_t(NO_ERROR); } sp<Fence> Fence::merge(const String8& name, const sp<Fence>& f1, |