Skip to content

Publisher is !Send #546

Answered by elfenpiff
yakiro-nvg asked this question in Q&A
Discussion options

You must be logged in to vote

@yakiro-nvg

Is there any reason that makes Publisher truly !Send?

Yes, there is. The SampleMut calls internal non-threadsafe constructs in the publisher when it goes out-of-scope or calls SampleMut::send(). If the sample were moved into a different thread and went out-of-scope there, it would cause a race condition inside the Publisher.

We are aware of the issue and will soon provide PublisherTs and SubscriberTs ports that are completely threadsafe and could then be used in a Python binding - here, you would pay a little extra for an additional mutex. The samples would then also come with such a variant.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yakiro-nvg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants