Skip to content

Decompression Threads #1

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Decompression Threads #1

wants to merge 9 commits into from

Conversation

ByteAlex
Copy link
Owner

@ByteAlex ByteAlex commented Dec 4, 2021

Instead of forcing context-switches with block_in_place when the tokio-runtime feature was enabled, we spawn a dedicated thread for the decompression and use std lib to send data over to the dedicated thread, handle decompression there and send the result back via a future oneshot channel.
This channel can be polled in a nested context from the ZlibStream implementation.

This PR is a replacement for the tokio-runtime feature in it's functionality, but the tokio-runtime feature is still available to use tokio::spawn_blocking for blocking tasks, instead of starting an own thread.
To enable the features from this PR, enable the thread feature flag.

@ByteAlex
Copy link
Owner Author

ByteAlex commented Dec 4, 2021

Formatting is a mess; I'm on my mac and I don't have my rustfmt updated... Fixing soon

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.

1 participant