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

Improve docs & code style in runInterruptibe #1994

Merged
merged 1 commit into from
May 7, 2020

Conversation

elizarov
Copy link
Contributor

@elizarov elizarov commented May 6, 2020

  • 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

* 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
@elizarov elizarov requested a review from qwwdfsad May 6, 2020 11:32
@elizarov elizarov merged commit 134a4bc into develop May 7, 2020
@elizarov elizarov deleted the interruptible-improve branch May 7, 2020 13:58
recheej pushed a commit to recheej/kotlinx.coroutines that referenced this pull request Dec 28, 2020
* 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
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.

2 participants