Replies: 1 comment 2 replies
-
You have not posted complete code, but I notice some issues immediately:
Consider reading Async: What is blocking? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to run two tasks using Tokio. Since I need to limit the number of threads, I initialize the runtime with a Builder. I use the block_on method to run both tasks. These two tasks are channel_loop and a loop that handles I/O requests. These tasks should not block each other.
In the I/O loop, data is sent through a priority channel, and the channel_loop task receives this data. Inside channel_loop, I create additional tasks using tokio::spawn(process_data()). My goal is to run multiple process_data() tasks asynchronously. Here is my code:
How can I ensure that the channel_loop and the loop handling I/O requests do not block each other while running multiple process_data() tasks asynchronously?
Beta Was this translation helpful? Give feedback.
All reactions