# ThreadTestUtil

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

*** ** * ** ***


```
@UnstableApi
class ThreadTestUtil
```

<br />

*** ** * ** ***

Static utility to coordinate threads in testing environments.

## Summary

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ThreadTestUtil#registerThreadIsBlockedUntilProgressOnLooper(androidx.media3.common.util.ConditionVariable,android.os.Looper)( conditionVariable: https://developer.android.com/reference/kotlin/androidx/media3/common/util/ConditionVariable!, looper: https://developer.android.com/reference/android/os/Looper.html! )` Registers that the current thread will be blocked with the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/util/ConditionVariable` until the specified `https://developer.android.com/reference/android/os/Looper.html` reports to have made progress via `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ThreadTestUtil#unblockThreadsWaitingForProgressOnCurrentLooper()`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ThreadTestUtil#unblockThreadsWaitingForProgressOnCurrentLooper()()` Unblocks any threads that are waiting for progress on the current `https://developer.android.com/reference/android/os/Looper.html` thread. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ThreadTestUtil#unblockThreadsWaitingForProgressOnLooper(android.os.Looper)(looper: https://developer.android.com/reference/android/os/Looper.html!)` Unblocks any threads that are waiting for progress on the specified `https://developer.android.com/reference/android/os/Looper.html` thread. |

## Public functions

### registerThreadIsBlockedUntilProgressOnLooper

```
java-static fun registerThreadIsBlockedUntilProgressOnLooper(
    conditionVariable: ConditionVariable!,
    looper: Looper!
): Unit
```

Registers that the current thread will be blocked with the provided `https://developer.android.com/reference/kotlin/androidx/media3/common/util/ConditionVariable` until the specified `https://developer.android.com/reference/android/os/Looper.html` reports to have made progress via `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ThreadTestUtil#unblockThreadsWaitingForProgressOnCurrentLooper()`.

| Parameters |
|---|---|
| `conditionVariable: https://developer.android.com/reference/kotlin/androidx/media3/common/util/ConditionVariable!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/util/ConditionVariable` that will block the current thread. |
| `looper: https://developer.android.com/reference/android/os/Looper.html!` | The `https://developer.android.com/reference/android/os/Looper.html` that must report progress to unblock the current thread. Must not be the `https://developer.android.com/reference/android/os/Looper.html` of the current thread. |

### unblockThreadsWaitingForProgressOnCurrentLooper

```
java-static fun unblockThreadsWaitingForProgressOnCurrentLooper(): Unit
```

Unblocks any threads that are waiting for progress on the current `https://developer.android.com/reference/android/os/Looper.html` thread.

### unblockThreadsWaitingForProgressOnLooper

```
java-static fun unblockThreadsWaitingForProgressOnLooper(looper: Looper!): Unit
```

Unblocks any threads that are waiting for progress on the specified `https://developer.android.com/reference/android/os/Looper.html` thread.