Skip to content

Conversation

@dima-avdeev-jb
Copy link

@dima-avdeev-jb dima-avdeev-jb commented Apr 4, 2023

Using launch { pressScope.reset() } is fine.

We already have the same in commonMain code:

Also, ComposeScene created with Dispatchers.Unconfined

coroutineContext: CoroutineContext = Dispatchers.Unconfined,

It means that it will launch{} coroutine immediately in the same thread before the first suspension point. (https://kotlinlang.org/docs/coroutine-context-and-dispatchers.html#unconfined-vs-confined-dispatcher)
So, pressScope.reset() inside launch will always be called before next launch{} calls

@dima-avdeev-jb dima-avdeev-jb requested review from Walingar and removed request for Walingar April 4, 2023 10:55
@dima-avdeev-jb dima-avdeev-jb changed the title TapGestureDetector.skiko.kt TapGestureDetector.skiko.kt remove TODO comments Apr 4, 2023
@igordmn
Copy link
Collaborator

igordmn commented Apr 4, 2023

Also, ComposeScene created with Dispatchers.Unconfined

It is only for tests. For real applications we use the UI thread, that will dispatch tasks on the next iteration. It even can dispatch task after the next frame, which will add an input lag. I discovered that here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants