<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
public class BroadcastFrameClock(private val onNewAwaiters: (() -> Unit)? = null) :
    MonotonicFrameClock
```


A simple frame clock.

This implementation is intended for low-contention environments involving low total numbers of
threads in a pool on the order of ~number of CPU cores available for UI recomposition work, while
avoiding additional allocation where possible.

`onNewAwaiters` will be invoked whenever the number of awaiters has changed from 0 to 1. If
`onNewAwaiters` **fails** by throwing an exception it will permanently fail this
`BroadcastFrameClock`; all current and future awaiters will resume with the thrown exception.


## Functions



<h2 id="sendframe-timenanos">sendFrame</h2>

```kotlin
public fun sendFrame(timeNanos: Long)
```


Send a frame for time `timeNanos` to all current callers of `withFrameNanos`. The `onFrame`
callback for each caller is invoked synchronously during the call to `sendFrame`.




<hr class="docs-overload-divider">


<h2 id="cancel-cancellationexception">cancel</h2>

```kotlin
public fun cancel(
        cancellationException: CancellationException = CancellationException("clock cancelled")
    )
```


Permanently cancel this `BroadcastFrameClock` and cancel all current and future awaiters with
`cancellationException`.