Tokio::select! sync operation #4011
-
Hi! So my basic problem is that I have a synchronous operation that I need to have running concurrently with the async operations in loop statement. The way I currently have it structured is like this
The main issue with this is that it introduces significant latency in performing the sync action. Is there a way I can either remove this latency (through a timeout maybe) or trick select! into thinking my sync action is async? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Generally one of the fundamental differences between async and sync is that sync operations simply cannot be cancelled, and that sync operations are blocking. The article behind that link has more background on this, and mentions some ways to offload the synchronous work to a thread pool, which may or may not work for you depending on the nature of the synchronous work. If possible, it would be best to make your sync operation async. |
Beta Was this translation helpful? Give feedback.
Generally one of the fundamental differences between async and sync is that sync operations simply cannot be cancelled, and that sync operations are blocking. The article behind that link has more background on this, and mentions some ways to offload the synchronous work to a thread pool, which may or may not work for you depending on the nature of the synchronous work.
If possible, it would be best to make your sync operation async.