Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

Resolves #4661.

To support this we need to change the algebra of ZIO slightly. lock describes a static scope of shifting onto and off of a thread pool around a given effect. However, that doesn't give us the power to describe shifting for dynamic scopes. To support this we remove lock as a primitive and replace it with shift, which shifts to a specified Executor. lock can then be implemented using a combination of shift and bracket. With this change, lock just becomes a ZManaged effect that describes shifting onto a thread pool as its acquire effect and shifting back as its release effect.

@adamgfraser adamgfraser requested a review from jdegoes February 6, 2021 23:33
Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

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

Looks really nice!

@jdegoes jdegoes merged commit cb2f621 into zio:master Feb 11, 2021
@adamgfraser adamgfraser deleted the lock branch February 11, 2021 23:08
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.

Create ZManaged.lock(...) for locking on custom Executor.

2 participants