# SyncFenceWrapper

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/video/SyncFenceWrapper.java+class:androidx.media3.common.video.SyncFenceWrapper)

*** ** * ** ***


```
@ExperimentalApi
class SyncFenceWrapper
```

<br />

*** ** * ** ***

A wrapper for `https://developer.android.com/reference/android/hardware/SyncFence.html` that exists on all API levels.

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/android/hardware/SyncFence.html!` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 33) https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper#asSyncFence()()` Returns the wrapped `https://developer.android.com/reference/android/hardware/SyncFence.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper#await(java.time.Duration)(timeout: https://developer.android.com/reference/java/time/Duration.html!)` Waits for the fence to signal. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper#awaitForever()()` Waits forever for the fence to signal. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper#awaitMs(long)(timeoutMs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Waits for the fence to signal. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper#close()()` Closes the fence. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper!` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 33) https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper#of(android.hardware.SyncFence)(syncFence: https://developer.android.com/reference/android/hardware/SyncFence.html!)` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper` that wraps the given `syncFence`. |

## Public functions

### asSyncFence

```
@RequiresApi(value = 33)
fun asSyncFence(): SyncFence!
```

Returns the wrapped `https://developer.android.com/reference/android/hardware/SyncFence.html`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if called on API level \<33. |

### await

```
@RequiresApi(value = 26)
fun await(timeout: Duration!): Boolean
```

Waits for the fence to signal.

### awaitForever

```
fun awaitForever(): Unit
```

Waits forever for the fence to signal.

### awaitMs

```
fun awaitMs(timeoutMs: Long): Boolean
```

Waits for the fence to signal.

### close

```
fun close(): Unit
```

Closes the fence.

### of

```
@RequiresApi(value = 33)
java-static fun of(syncFence: SyncFence!): SyncFenceWrapper!
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/common/video/SyncFenceWrapper` that wraps the given `syncFence`.