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

Develop #7

Merged
merged 274 commits into from
Apr 14, 2021
Merged

Develop #7

merged 274 commits into from
Apr 14, 2021

Conversation

circusmagnus
Copy link
Owner

Merge with parent repo

turansky and others added 30 commits April 27, 2020 14:53
…1732)

Flow.onCompletion now reports all failures and cancellation in its cause just like invokeOnCompletion. A null cause is reported if and only if flow had completed successfully (no failure, no cancellation). Emission of additional elements after the end of the flow is only possible from inside of onCompletion block in case of successful completion.

Also fixed a bug where onCompletion implementation was trying to add exception to its own list of suppressed exceptions, which is not allowed.

Fixes #1693
… integrate with APIs that may block the current thread, but react on cancellation (#1680)

Fixes #1671
* Remove experimental annotation from Flow terminal and Channel operators
* Remove experimental annotation from Flow count* and reduce* operators
* Remove experimental annotation from Flow operations, including buffer and flowOn
* Remove experimental annotation from combine and zip
This reverts commit 76e6440
* Support thread interrupting blocking functions (#1947)

This is the implementation of issue #1947

Signed-off-by: Trol <jiaoxiaodong@xiaomi.com>
Co-authored-by: Trol <jiaoxiaodong@xiaomi.com>
* Kotlin DSL - 'android:example-app' (#1940)
* 'android:example-app'. Gradle 5.6.1 - sync with root project
* Kotlin DSL - 'android:example-app'
* Kotlin DSL - 'android:animation-app' (#1941)
* 'android:animation-app'. Gradle 5.6.1 - sync with root project
* Kotlin DSL - 'android:animation-app'
* Kotlin DSL - 'swing' (#1943)
* Kotlin DSL - 'integration:jdk8' (#1944)
* Kotlin DSL - 'test' (#1945)
* Kotlin DSL - 'reactive:reactive' (#1946)
* Kotlin DSL - 'android-unit-tests'
* Use relative paths
* Kotlin DSL - 'js-stub' (#1938) (#1959)
* Kotlin DSL - 'android' (#1938) (#1956)
* Kotlin DSL - 'stdlib-stubs' (#1938) (#1955)
* Kotlin DSL - 'site' (#1938) (#1954)
* Kotlin DSL - 'maven-central' (#1938) (#1953)
* Kotlin DSL - 'benchmarks' (#1938) (#1952)

Co-authored-by: Victor Turansky <victor.turansky@gmail.com>
* Use standard random API
* Inline 'random' method
I've failed to write a reliable test here. See also #571

Fixes #1992
* Fix code formatting in doc example and make it more concise (both vertically and horizontally).
* Don't promote custom `withTimeout` logic in examples. Use the actual `withTimeout` function.
* Logical introduction of `context` parameter in docs (first use without it, then explain how it helps), consistent doc references.
* Improved implementation in various places:
  * runInterruptibleInExpectedContext does not have to be suspend
  * There is always Job in the context
  * ThreadState should not do complex init in constructor (that's bad style)
  * ThreadState does not need inner State class, atomic int is enough
  * Consistent project-wide variable naming: state -> _state
  * Consistent use of `error` function to throw IllegalStateException
Spell-check & subject/body separation inspection
StateFlow is a Flow analogue to ConflatedBroadcastChannel. Since Flow API
is simpler than channels APIs, the implementation of StateFlow is
simpler. It consumes and allocates less memory, while still providing
full deadlock-freedom (even though it is not lock-free internally).

Fixes #1973
Fixes #395
Fixes #1816

Co-authored-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
* Using Kotlin official style
* Start imports for all packages
* Continuation indent size = 4
* Restore java configuration for 'benchmarks'
* Apply 'jmh' plugin after java configuration
* Specify java.util.concurrent imports after migration to Java 11
* Remove duplicated dependency
* Use release version of 'jmh' plugin. '0.5.0-rc-2' -> '0.5.0'
chao2zhang and others added 29 commits March 17, 2021 11:56
* It slightly cuts down startup time
    * It simplifies the code in general
    * It do not serve its purpose, coroutines are already protected from StackOverflowError with nested event-loops where applicable
* Update Gradle to 4.8.3, add space-dev repository
* Update atomicfu and binary compatibility validator
* Merge onStartInternal and onStart to reduce the number of methods and make code a bit simpler
* Rework initParentJob
* Always establish a parent-child relationship when creating a subclass of AbstractCoroutine. That's our own internal class that we have full control of and it never has a chance to leak to the user-code (so cancellation handlers will be installed etc.).  Force implementors of AbstractCoroutine deliberately choose whether parent-child relationship should be established
 * As a consequence, get rid of parentContext in all our coroutine classes that are not ScopeCoroutine
* Remove some dead code
* Get rid of an additional parent field from ScopeCoroutine
 Leverage already presented information in our implementation, just expose it via an already present internal interface
* Update SharedFlow documentation
* Rework reusability control in cancellable continuation

    * Update initCancellability documentation and implementation to be aligned with current invariants
    * Make parentHandle non-volatile and ensure there are no races around it
    * Establish new reusability invariants
      - Reusable continuation can be used _only_ if it states is not REUSABLE_CLAIMED
      - If it is, spin-loop and wait for release
      - Now the parent is attached to reusable continuation only if it was suspended at least once. Otherwise, the state machine can return via fast-path and no one will be able to release intercepted continuation (-> detach from parent)
      - It implies that the parent is attached after trySuspend call and can be concurrently reused, this is where new invariant comes into play
    * Leverage the fact that it's non-atomic and do not check it for cancellation prematurely. It increases the performance of fast-path, but potentially affects rare cancellation cases

Fixes #2564
    * Introduce three-state ChannelResult, a domain-specific Result class counterpart
    * Introduce receiveCatching/onReceiveCatching, make it public
    * Get rid of receiveOrClosed/onReceiveOrClosed without migrations, it was @InternalCoroutinesApi anyway

Fixes #330
…cement for error-prone offer, poll and receiveOrNull

Fixes #974
* Fix wrong docs on Job.join and Job.cancelAndJoin

Fixes #2615
* Deprecation and migration of receiveOrNull and onReceiveOrNull.

    * Raise deprecation level for members, introduce deprecation for extensions
    * Explain rationale behind deprecation
    * Provide default implementation for deprecated members in Channel interface
    * Get rid of the internal implementation, leverage receiveCatching
    * Introduce new extensions for ChannelResult and use them as a replacement in our own operators

Fixes #1676
The implementation of Reactive Streams' Subscriber used for
`await*` operations was assuming that the publisher is correct.
Now, the implementation detects some instances of problematic
behavior for publishers and reports them.

Fixes #2079
…entical 'ensureActive' extension to reduce code duplication (#2467)
    * Remove all deprecated inline methods
    * Move the rest to the Deprecated.kt
    * Apply Deprecated.HIDDEN where possible, otherwise use internal + published API
    * Remove all deprecated inline methods
    * Promote ERROR to HIDDEN where applicable
    * Promote WARNING to ERROR where applicable
* Embrace new channel API

    * Introduce trySendBlocking and deprecate sendBlocking
    * Use it in callbackFlow example
    * Stabilize callbackFlow and channelFlow as they finally have error-safe API
    * Irrelevant: migrate from deprecated stdlib API to be able to build with Kotlin 1.5


Co-authored-by: Roman Elizarov <elizarov@gmail.com>
* Otherwise Kotlin users with non-reactive background get confused by flow/stdlib inconsistency
    * Make it experimental to delay the final decision about the name

Fixes #2641
…ages along the codebase (#2644)

* Deprecate SendChannel.offer and replace its usages along the codebase
* Deprecate ReceiveChannel.poll and replace its usages along the codebase

Co-authored-by: Roman Elizarov <elizarov@gmail.com>

Addresses #974
@circusmagnus circusmagnus merged commit 3aaf7bd into circusmagnus:develop Apr 14, 2021
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.