Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriber does not feature the "Send" Trait #152

Closed
mschnell1 opened this issue May 8, 2023 · 2 comments · Fixed by #159
Closed

Subscriber does not feature the "Send" Trait #152

mschnell1 opened this issue May 8, 2023 · 2 comments · Fixed by #159

Comments

@mschnell1
Copy link

mschnell1 commented May 8, 2023

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

@mschnell1 mschnell1 changed the title subscriber does nort implement "send" subscriber does not implement "send" May 8, 2023
@mschnell1 mschnell1 changed the title subscriber does not implement "send" subscriber does not feature "send" May 8, 2023
@mschnell1 mschnell1 changed the title subscriber does not feature "send" Subscriber does not feature the "Send" Trait May 8, 2023
@MathiasKoch
Copy link
Member

MathiasKoch commented May 10, 2023

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

@rmja
Copy link
Contributor

rmja commented May 10, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants