SyncFenceCompat
class SyncFenceCompat : AutoCloseable
A synchronization primitive which signals when hardware units have completed work on a particular resource. They initially start in an unsignaled state and make a one-time transaction to either a signaled or error state.
SyncFenceCompat is a presentation fence used in combination with SurfaceControlCompat.Transaction.setBuffer. Note that depending on API level, this will utilize either android.hardware.SyncFence or a compatibility implementation.
Summary
Public companion functions |
|
|---|---|
SyncFenceCompat |
Creates a native synchronization fence from an EGLSync object. |
Public functions |
|
|---|---|
Boolean |
Waits for a |
Boolean |
Waits forever for a |
open Unit |
close()Close the |
Long |
@RequiresApi(value = 26)Returns the time that the fence signaled in the CLOCK_MONOTONIC time domain. |
Boolean |
isValid()Checks if the SyncFence object is valid. |
Constants
SIGNAL_TIME_INVALID
const val SIGNAL_TIME_INVALID: Long
An invalid signal time. Represents either the signal time for a SyncFence that isn't valid (that is, isValid is false), or if an error occurred while attempting to retrieve the signal time.
SIGNAL_TIME_PENDING
const val SIGNAL_TIME_PENDING: Long
A pending signal time. This is equivalent to the max value of a long, representing an infinitely far point in the future.
Public companion functions
createNativeSyncFence
fun createNativeSyncFence(): SyncFenceCompat
Creates a native synchronization fence from an EGLSync object.
| Throws | |
|---|---|
kotlin.IllegalStateException |
if EGL dependencies cannot be resolved |
Public functions
await
fun await(timeoutNanos: Long): Boolean
Waits for a SyncFenceCompat to signal for up to the timeout duration
| Parameters | |
|---|---|
timeoutNanos: Long |
time in nanoseconds to wait for before timing out. |
getSignalTimeNanos
@RequiresApi(value = 26)
fun getSignalTimeNanos(): Long
Returns the time that the fence signaled in the CLOCK_MONOTONIC time domain. This returns an instant, SyncFenceCompat.SIGNAL_TIME_INVALID if the SyncFence is invalid, and if the fence hasn't yet signaled, then SyncFenceCompat.SIGNAL_TIME_PENDING is returned.