SFML community forums
Help => General => Topic started by: Honorabl3 on September 30, 2013, 07:17:51 pm
-
I'm on my phone to type this, but I wanted to see if there was a solution to my problem. I won't be going into too much depth unless really absoluty needed. Anyway I'll hop into the issue.
It seems when I tell a thread to run from a class method, it won't work.
void player::blah()
{
sf::Thread thread(&rawr, sf::Vector2f(6, 5));
thread.launch();
}
void player::rawr(sf::Vector2f dir)
{
//rawr stuff
}
P.S. I have read the thread documentation. It hasn't helped.
-
Seriously (http://www.sfml-dev.org/tutorials/2.1/system-thread.php#common-mistakes)?
-
Yep read the last paragraph "again". The thread goes out of scope, thus gets destroyed and join is called in the destructor. ;)
-
Well, that seems to be the answer to my three day problem I've been having. Once I get home I'll test it.