Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain SafeCollector hackery #3811

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update kotlinx-coroutines-core/jvm/src/flow/internal/SafeCollector.kt
Co-authored-by: Dmitry Khalanskiy <[email protected]>
  • Loading branch information
qwwdfsad and dkhalanskyjb committed Nov 30, 2023
commit a02aad5f329ca1e7ed3b4dfdde7df58c238143c0
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ internal actual class SafeCollector<T> actual constructor(

/**
* Here we use the following trick:
* - Proceed with all checks required
* - Perform all the required checks
* - Having a non-intercepted, non-cancellable caller's `uCont`, we leverage our implementation knowledge
* and invoke `collector.emit(T)` as `collector.emit(value: T, completion: Continuation), passing `this`
* as the completion. We also setup `this` state, so if the `completion.resume` is invoked, we are
Expand Down