Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Enviroment #214

Merged
merged 12 commits into from
Jul 8, 2020
Merged

Enviroment #214

merged 12 commits into from
Jul 8, 2020

Conversation

nomisRev
Copy link
Member

@nomisRev nomisRev commented Jul 2, 2020

This PR proposes an [Enviroment] interface, that can be used instead of the bare bones runners which don't provide elegant syntax.

The Enviroment type offers the same runners as UnsafeRun currently offers for F.
It however also incorporates CoroutineContext and asyncErrorHandler.

  • asyncErrorHandler would currently be called only for cancellableF when it's returned CancelToken throws an exception. ref.

  • CoroutineContext defines an initial ctx for unsafeRunSync so we don't need an EventLoop. This however means that by defaultunsafeRunSync called from main runs on ForkJoinPool.
    Alternative would be to start on EmptyCoroutineContext but then we'd return the user to ForkJoinPool after the first sleep or other parallel op.

settings.gradle Outdated Show resolved Hide resolved
*
* This contract could be elaborated on Android to provide automatic cancellation on Android LifecycleOwner.
*/
interface Environment {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the implementation. Can't wait to use it! 😃

@nomisRev
Copy link
Member Author

nomisRev commented Jul 2, 2020

Thanks @joramnv for the code review! 🙌

Copy link
Member

@JorgeCastilloPrz JorgeCastilloPrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits but looks good!

arrow-docs/docs/fx/README.md Show resolved Hide resolved
arrow-docs/docs/fx/README.md Show resolved Hide resolved
arrow-docs/docs/fx/README.md Show resolved Hide resolved
arrow-docs/docs/fx/README.md Outdated Show resolved Hide resolved
arrow-docs/docs/fx/README.md Outdated Show resolved Hide resolved

/**
* Execution strategies that will immediately return and perform the program's work without blocking the current thread.
* This operation runs uncancellable.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth adding a note about how exceptions are handled in this particular case.

Copy link
Member

@pakoito pakoito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see this idea evolve :D

@nomisRev nomisRev merged commit b342185 into master Jul 8, 2020
@nomisRev nomisRev deleted the sv-enviroment branch July 8, 2020 13:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants