-
Notifications
You must be signed in to change notification settings - Fork 28
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
SBMLTransforms thread safety #232
Comments
- use a local map to store component values instead of using the static map in SBMLTransforms - now safe to call these functions from multiple threads (see sbmlteam#232)
ideally, for a non-changing model, it should suffice to compute the map only once. But this wasnt' the case as the old code always called mapComponentValues and clear later on. Would need to consult with @skeating what else we can do. |
I think ideally there would be a map for each model, rather than a single libsbml-wide map. (Even without multiple threads and assuming the map is only computed once, if you have two different models open in libsbml wouldn't they currently both use the same Some (maybe naive) ideas:
something like
|
Both approaches would work, i slightly like the latter one more. Since this map would be used / updated / replaces solely by SBMLTransforms. Why would you go with |
Not sure why I used a |
I'm not sure i can get to it this week, but i can have it done by next. Thanks again for letting us know. |
SBMLTransforms uses a static member variable map mValues for caching component values.
If libsbml is used from multiple threads this can cause corrupted data and/or segfaults since all the threads are using the same map, e.g. if one thread clears the map while another thread is using it (see spatial-model-editor/spatial-model-editor#786)
The text was updated successfully, but these errors were encountered: