Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient synchronization primitives for a single-threaded async app in Rust

I have a tokio-based single-threaded async app where using Arcs or other Sync types seems to be an overhead. Because there is no need for synchronization between threads, I am looking for something like tokio::sync::oneshot::channel, Sender and Receiver of which should be !Sync and could be wrapped into Rc instead of Arc.

Are there any specially crafted synchronization primitives for usage in single-threaded async apps in Rust?

like image 480
Fedorov7890 Avatar asked Aug 11 '26 12:08

Fedorov7890


1 Answers

You can take a look at the various Local types in futures-intrusive. E.g. the LocalOneshotChannel requires no mutex.

like image 61
Matthias247 Avatar answered Aug 14 '26 12:08

Matthias247



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!