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

Introducing thread-safety in lib.rs #75

Open
panosfol opened this issue Jul 8, 2024 · 3 comments
Open

Introducing thread-safety in lib.rs #75

panosfol opened this issue Jul 8, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request rust-libs

Comments

@panosfol
Copy link
Collaborator

panosfol commented Jul 8, 2024

Our rust module currently is not thread safe, there are a lot of critical sections according to the output of valgrind --tool=helgrind.
The difficulty of introducing thread-safety in our rust module is that the mutex should be locked and unlocked from the C side of our codebase, since we cant create a new mutex inside our rust module.
Therefore I suggest an interface be created that will have the necessary functions of handling a mutex lock_mutex(), init_mutex(), destroy_mutex() etc. and just extern those functions to the Rust side. That way we can handle the mutex inside the rust library without worrying where the mutex is defined, created and destroyed.

@charmitro
Copy link
Contributor

Should we include mutexes within the Rust module, or manage them externally? Is there a way to test and compare the performance impact of locking mechanisms implemented inside the Rust module versus outside of it?

@panosfol
Copy link
Collaborator Author

panosfol commented Jul 9, 2024

Yes after #74 is resolved, ill benchmark it with the mutex being handled internally and externally, and post the results here for further discussion.

@charmitro
Copy link
Contributor

charmitro commented Jul 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rust-libs
Projects
None yet
Development

No branches or pull requests

2 participants