diff options
author | 2016-10-13 16:21:26 +0000 | |
---|---|---|
committer | 2016-10-13 16:21:26 +0000 | |
commit | 236c475de47a41df4dfab4c2716818dce5c12ffa (patch) | |
tree | c295fd2b73f0a30dff811e75c91f7c560971c76d | |
parent | a0244b25de25330c4593190ce8be03fe0e9fc151 (diff) | |
parent | 5736f7dc1535452799ef2ea2026b7d1465567a31 (diff) |
libui: Add hasSignaled() method to Fence
am: 5736f7dc15
Change-Id: I14519e0db9d203d88655906b84e5bac7310ca2df
-rw-r--r-- | include/ui/Fence.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/ui/Fence.h b/include/ui/Fence.h index d45ad762da..2fbc9efb45 100644 --- a/include/ui/Fence.h +++ b/include/ui/Fence.h @@ -96,6 +96,17 @@ public: // occurs then -1 is returned. nsecs_t getSignalTime() const; + // hasSignaled returns whether the fence has signaled yet. Prefer this to + // getSignalTime() or wait() if all you care about is whether the fence has + // signaled. + inline bool hasSignaled() { + // The sync_wait call underlying wait() has been measured to be + // significantly faster than the sync_fence_info call underlying + // getSignalTime(), which might otherwise appear to be the more obvious + // way to check whether a fence has signaled. + return wait(0) == NO_ERROR; + } + // Flattenable interface size_t getFlattenedSize() const; size_t getFdCount() const; |