Rust 中单线程异步应用程序的高效同步原语
Efficient synchronization primitives for a single-threaded async app in Rust
我有一个 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
和 Receiver
,其中应该是 !Sync
并且可以包装到 Rc
而不是 Arc
.
是否有任何特制的同步原语可用于
Rust 中的单线程异步应用程序?
您可以查看 futures-intrusive. E.g. the LocalOneshotChannel 中的各种 Local
类型,不需要互斥锁。
我有一个 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
和 Receiver
,其中应该是 !Sync
并且可以包装到 Rc
而不是 Arc
.
是否有任何特制的同步原语可用于 Rust 中的单线程异步应用程序?
您可以查看 futures-intrusive. E.g. the LocalOneshotChannel 中的各种 Local
类型,不需要互斥锁。