Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SetPosition and mutex. Anyway inbuilt way to avoid?  (Read 2015 times)

0 Members and 1 Guest are viewing this topic.

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
SetPosition and mutex. Anyway inbuilt way to avoid?
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SetPosition and mutex. Anyway inbuilt way to avoid?
« Reply #1 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.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
SetPosition and mutex. Anyway inbuilt way to avoid?
« Reply #2 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.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

 

anything