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

Add support for async runtime initialization (tokio) #147

Closed
ecton opened this issue Mar 26, 2024 · 0 comments
Closed

Add support for async runtime initialization (tokio) #147

ecton opened this issue Mar 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ecton
Copy link
Member

ecton commented Mar 26, 2024

Due to how winit takes over the main thread on all currently supported platforms, helpers like #[tokio::main] aren't compatible with Cushy. This is because any tasks assigned to the executor runtime on the main thread will never be yielded to. Additionally, Cushy spawns extra threads. For example, trying to call tokio::spawn from an animation callback will fail because the animation thread doesn't know about the tokio runtime.

We need a way to allow users to initialize a runtime on each thread Cushy spawns, and we should make it really easy to enable tokio support.

How to use Tokio today

I've created a minimal example showing how to integrate Tokio and Cushy here: https://github.com/khonsulabs/cushy-tokio-example

@ecton ecton added the enhancement New feature or request label Mar 26, 2024
@ecton ecton changed the title Add support for async runtime initialization Add support for async runtime initialization (tokio) Mar 26, 2024
@ecton ecton closed this as completed in b57188f May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant