Skip to content
Discussion options

You must be logged in to vote

@drewlwhitney

I personally don't think that tokio is a bad idea in general. AFAIK only #[tokio:main] is discouraged.

In my sample I create a tokio runtime manually, extract the handle and operate on a clone of the handle or in case of the UI thread on the original. This seems to work fine, although I must say that using libraries that may be blocking (e.g. evdev) is a bit tricky.

Tokio might no longer switch threads when a loop is used within a tokio::spawn and results in never finishing work / deadlock. So my personal approach now is to use tokio::spawn for all crates that officially support tokio (like sea-orm) and to use std for everything else, because std creates REAL threads.

This w…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@drewlwhitney
Comment options

@ogoffart
Comment options

@drewlwhitney
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@drewlwhitney
Comment options

Answer selected by drewlwhitney
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants