-
Notifications
You must be signed in to change notification settings - Fork 89
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
Investigate thread safety of rust-sfml #228
Comments
|
The following may be the root issue: Hence possibly all subclasses of sf::GlResource are not thread safe. |
Thank you, that's useful information! |
I noticed an implementation detail that may be relevant for thread safety: In const Transform& Transformable::getTransform() const
{
// Recompute the combined transform if needed
if (m_transformNeedUpdate)
{
...
m_transform = Transform( sxc, sys, tx,
-sxs, syc, ty,
0.f, 0.f, 1.f);
m_transformNeedUpdate = false;
}
return m_transform;
} Changing class SFML_GRAPHICS_API Transformable
{
...
private:
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
...
mutable Transform m_transform; //!< Combined transformation of the object
mutable bool m_transformNeedUpdate; //!< Does the transform need to be recomputed?
mutable Transform m_inverseTransform; //!< Combined transformation of the object
mutable bool m_inverseTransformNeedUpdate; //!< Does the transform need to be recomputed?
}; The same would probably be true for other getter that are using caching as well. I guess it would be possible to mark all such functions with an additional (I am NOT 100% sure if this really is an issue...) |
Thank you, that's very useful information! |
So far most of the effort has been to make the library safe to use in a single-threaded context, but there haven't been much investigation on how it behaves when multiple threads are involved.
Related/sub issues:
Related pull requests:
The text was updated successfully, but these errors were encountered: