-
Notifications
You must be signed in to change notification settings - Fork 21
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
Thread safety #16
Comments
Analog doesn't guarantee thread-safety of the libiio functions, even if some of them happen to be usable across threads in their current implementation ( https://ez.analog.com/linux-software-drivers/f/q-a/90775/safe-to-assume-that-libiio-calls-are-thread-safe/197587#197587 ) The unreleased master branch exposes |
Thread safety is guaranteed in the libiio functions. Libiio has been developed from the ground up with the idea that it should be thread-safe. |
@pcercuei Thanks for bringing this up! I have been in the same boat as @tomstokes; after reading some old blog posts, etc, was under the assumption that the library was not thread safe. The problem with Rust (oops... I mean the great thing about Rust) is that it requires you to be completely explicit about things in regard to thread safety. So the statement "you can't access ... some resources at the same time" gets a little tricky. But I will definitely look into it for the next version. |
Having thought about this for a while, I'll likely split the difference... Having believed that the contexts were not thread-safe, I made all the Rust objects Ha! Try that in C. 😄 But, with this new information, I'll start relaxing those constraints, starting by making As a first step, it would mean that a But certainly it sounds like the I'll take these one step at a time, with a release in between to try and get it right. ...and I'll update the README. |
The readme states that "the contexts and devices in the underlying libiio are not thread safe."
They actually are, though. You can't obviously access some resources at the same time (e.g. trying to refill a buffer in two different threads at the same time), but you can read/write attributes in one thread and manipulate the buffer in another thread, it works just fine.
The text was updated successfully, but these errors were encountered: