DynamicSender and DynamicReceiver, just seem to be a fat pointer to a Channel which is already protected by it's own Mutex already. In fact, you can share the Channel already betwen threads and create Dynamic*er's in the target threads. It should be safe to share the Dynamic*er's directly. Can only be used when Mutex M of channel supoorts Sync.
embassy-sync
An Embassy project.
Synchronization primitives and data structures with async support:
Channel- A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer.PriorityChannel- A Multiple Producer Multiple Consumer (MPMC) channel. Each message is only received by a single consumer. Higher priority items are shifted to the front of the channel.PubSubChannel- A broadcast channel (publish-subscribe) channel. Each message is received by all consumers.Signal- Signalling latest value to a single consumer.Watch- Signalling latest value to multiple consumers.Mutex- Mutex for synchronizing state between asynchronous tasks.Pipe- Byte stream implementingembedded_iotraits.WakerRegistration- Utility to register and wake aWaker.AtomicWaker- Utility to register and wake aWakerfrom interrupt context.MultiWakerRegistration- Utility registering and waking multipleWaker's.LazyLock- A value which is initialized on the first access
Interoperability
Futures from this crate can run on any executor.