SyncFenceCompat


@ExperimentalApi
class SyncFenceCompat : AutoCloseable


A helper class that allows duplicating a SyncFence, and wrapping a fence file descriptor on earlier API levels.

Summary

Public functions

java-static SyncFenceCompat!
adoptFenceFileDescriptor(fileDescriptor: Int)

Take ownership of a raw native fence file descriptor into a new SyncFenceCompat.

Boolean
await(timeoutMs: Int)

Waits for the fence to signal.

Unit
java-static SyncFenceCompat!
@RequiresApi(value = 33)
duplicate(syncFence: SyncFence!)

Creates an instance that duplicates a SyncFence.

Public functions

adoptFenceFileDescriptor

java-static fun adoptFenceFileDescriptor(fileDescriptor: Int): SyncFenceCompat!

Take ownership of a raw native fence file descriptor into a new SyncFenceCompat.

The returned instance now owns the given file descriptor, and will be responsible for closing it.

Graphics APIs such as Vulkan are a common source of a native fence file descriptors.

Parameters
fileDescriptor: Int

The raw native fence file descriptor.

await

fun await(timeoutMs: Int): Boolean

Waits for the fence to signal.

Parameters
timeoutMs: Int

The timeout in milliseconds. A negative value means infinite timeout.

Returns
Boolean

Whether the fence signaled within the timeout.

Throws
android.system.ErrnoException

If an error occurs while polling the fence. See the Linux manual pages for the poll system call.

close

fun close(): Unit

duplicate

@RequiresApi(value = 33)
java-static fun duplicate(syncFence: SyncFence!): SyncFenceCompat!

Creates an instance that duplicates a SyncFence. Both fences must be closed independently.