FactbirdHQ / atat

no_std crate for parsing AT commands
Apache License 2.0
115 stars 31 forks source link

Subscriber does not feature the "Send" Trait #152

Closed mschnell1 closed 1 year ago

mschnell1 commented 1 year ago

When doing ATAT on tokio, it seems appropriate, and in fact demonstrates a great feature provided with this crate, to tokio::spawn multiple threads for multiple subscribers fetched by BUFFERS.urc_channel.subscribe();
I was not able to do this as seemingly the DynSubscriber struct returned does not feature Send which is necessary for using it as an argument for the async fn to be spawned by tokio. (As a workaround I currently only use one subscriber and use it in a main thread loop by let urc_handle = subscriber.next_message(); - while doing the client.send() activity in a tokio thread.

dyn PubSubBehavior<urc::Urc> cannot be shared between threads safely ... required by a bound introduced by this call

Suggestion: while embassy_sync::pubsub::DynSubscriber does not feature Send, embassy_sync::pubsub::Subscriber seemingly does.

-Michael

MathiasKoch commented 1 year ago

@rmja would there be any issues changing it from DynSubscriber to Subscriber, apart from the extra annoying generic parameter?

rmja commented 1 year ago

I don't think so. That would be a fine change.