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

compat: support 0.1 blocking #1722

Closed
hawkw opened this issue Nov 1, 2019 · 2 comments
Closed

compat: support 0.1 blocking #1722

hawkw opened this issue Nov 1, 2019 · 2 comments
Assignees
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-runtime Module: tokio/runtime T-v0.1.x Topic: tokio 0.1.x

Comments

@hawkw
Copy link
Member

hawkw commented Nov 1, 2019

Subcrates

tokio-compat

Description

The initial version of tokio-compat's compatibility runtime added in #1663 doesn't support the calls to tokio_threadpool 0.1's blocking. This is because (unlike the timer, executor, and reactor), there's no way to override the global blocking functionality in tokio-threadpool.

As discussed in #1663 (comment) and #1663 (comment), I think the ideal solution is to modify the Tokio 0.1 threadpool to add hooks for overriding the blocking behavior.

@hawkw hawkw self-assigned this Nov 7, 2019
hawkw added a commit that referenced this issue Nov 12, 2019
## Motivation

The initial version of `tokio-compat`'s compatibility runtime added in
#1663 doesn't support the calls to `tokio_threadpool` 0.1's `blocking`.
This is because (unlike the timer, executor, and reactor), there's no
way to override the global `blocking` functionality in
`tokio-threadpool`.

## Solution

As discussed [here][1], this branch adds APIs to the v0.1.x version of
`tokio-threadpool` that allow overriding the behavior used by calls to
`blocking`. The threadpool crate now exposes `blocking::set_default` and
`blocking::with_default` functions, like `executor`, `timer`, and
`reactor`. This will allow `tokio-compat` to override calls to 0.1's
`blocking` to use the new `tokio` 0.2 blocking APIs.

Unlike the similar APIs in `executor`, `timer`, and `reactor`, the hooks
for overriding blocking behaviour are `#[doc(hidden)]` and have comments
warning against their use outside of `tokio-compat`. In general, there 
probably won't be a compelling reason to override these outside of the 
compatibility layer.

Refs: #1722

[1]: #1663 (comment)

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
@hawkw
Copy link
Member Author

hawkw commented Nov 22, 2019

This is blocked on #1752, #1751, and #1733

@carllerche
Copy link
Member

Closing due to inactivity.

@Darksonn Darksonn added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-runtime Module: tokio/runtime T-v0.1.x Topic: tokio 0.1.x labels Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-runtime Module: tokio/runtime T-v0.1.x Topic: tokio 0.1.x
Projects
None yet
Development

No branches or pull requests

3 participants