SyncFenceWrapper


@ExperimentalApi
public final class SyncFenceWrapper


A wrapper for SyncFence that exists on all API levels.

Summary

Public methods

SyncFence
@RequiresApi(value = 33)
asSyncFence()

Returns the wrapped SyncFence.

boolean
@RequiresApi(value = 26)
await(Duration timeout)

Waits for the fence to signal.

void

Waits forever for the fence to signal.

boolean
awaitMs(long timeoutMs)

Waits for the fence to signal.

void

Closes the fence.

static SyncFenceWrapper
@RequiresApi(value = 33)
of(SyncFence syncFence)

Returns a SyncFenceWrapper that wraps the given syncFence.

Public methods

asSyncFence

@RequiresApi(value = 33)
public SyncFence asSyncFence()

Returns the wrapped SyncFence.

Throws
java.lang.IllegalStateException

if called on API level <33.

await

@RequiresApi(value = 26)
public boolean await(Duration timeout)

Waits for the fence to signal.

awaitForever

public void awaitForever()

Waits forever for the fence to signal.

awaitMs

public boolean awaitMs(long timeoutMs)

Waits for the fence to signal.

close

public void close()

Closes the fence.

of

@RequiresApi(value = 33)
public static SyncFenceWrapper of(SyncFence syncFence)

Returns a SyncFenceWrapper that wraps the given syncFence.