SFML community forums

Help => Window => Topic started by: mercurio7891 on January 15, 2011, 06:40:50 am

Title: SetPosition and mutex. Anyway inbuilt way to avoid?
Post by: mercurio7891 on January 15, 2011, 06:40:50 am
Hi, is there anyway inbuilt thread safe flag in sfml which I can specify to allow calls to be thread safe? or do I have to manually wrap every sfml call with a mutex.

for e.g sf::Window::SetPosition which can be access from multiple thread.

Must I have a mutex for every SetPosition call?

regards
Title: SetPosition and mutex. Anyway inbuilt way to avoid?
Post by: Laurent on January 15, 2011, 08:32:43 am
SFML is not thread safe, you have to protect yourself the variables that may be accessed by multiple threads. Which is by the way far more optimal than providing thread-safety by default in SFML.
Title: SetPosition and mutex. Anyway inbuilt way to avoid?
Post by: Groogy on January 15, 2011, 02:12:20 pm
Wrapping anything with mutexes or the like is far from optimal and more or less works against parallel programming. Making SFML thread-safe by default wouldn't help, actually be bad.