Skip to content

Commit 60716fd

Browse files
More comments.
1 parent 72d58a8 commit 60716fd

File tree

1 file changed

+4
-1
lines changed
  • workflow-runtime/src/commonMain/kotlin/com/squareup/workflow1/internal/compose

1 file changed

+4
-1
lines changed

workflow-runtime/src/commonMain/kotlin/com/squareup/workflow1/internal/compose/RecomposerDriver.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ private class RealRecomposerDriver(
140140
frameRequestChannel.onReceive { request ->
141141
// Re-enqueue the request so it will be picked up by the next call to tryGetFrameRequest.
142142
// We could use a separate property for this instead of the channel, but this keeps a single
143-
// source of truth.
143+
// source of truth. There's no race condition with other frames being sent unless
144+
// runRecomposeAndApplyChanges is called multiple times, since the compose runtime loop only
145+
// calls withFrameNanos from a single coroutine, so if there's a frame then we know that
146+
// coroutine is suspended and can't call it again.
144147
frameRequestChannel.requireSend(request)
145148
block()
146149
}

0 commit comments

Comments
 (0)