Reputation: 1245
I have a tokio-based single-threaded async app where using Arc
s 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?
Upvotes: 7
Views: 1366
Reputation: 10396
You can take a look at the various Local
types in futures-intrusive. E.g. the LocalOneshotChannel requires no mutex.
Upvotes: 3