SFML community forums

Help => System => Topic started by: bisthebis on February 01, 2016, 05:19:10 pm

Title: How do std::thread and sf::thread compare ?
Post by: bisthebis on February 01, 2016, 05:19:10 pm
I've read that using std:thread is better than SFML Thread if they are availabe.
To me they aren't (MinGW doesn't support them).
Since I'm programming for myself, I guess I shouldn't get a headache to switch compiler, but I'd like to know how better std::thread are.
Are they more efficient ? (I guess not, since it looks like it's just system calls)
More flexible ?
More portable ? (Well, I guess not since that's fort portability that I don't use them :D)
Or is it juste because relying on STL is considered better ?
Title: Re: How do std::thread and sf::thread compare ?
Post by: Hapax on February 01, 2016, 05:25:18 pm
std::thread is available from C++11 onwards. If your compiler doesn't support C++11, you can use sf::thread instead.
However, you should be easily able to upgrade your compiler to one that supports C++11 (or even C++14). SFML itself will use C++11 when version 3 is released and will then most likely dump sf::thread so it can use std::thread.
Title: Re: How do std::thread and sf::thread compare ?
Post by: bisthebis on February 01, 2016, 05:43:10 pm
I see. My compiler supports C++11... except thread. I'll have a look at newer compilers.
BTW, I've never heard of SFML 3. How long has the team been working on it ?
Title: Re: How do std::thread and sf::thread compare ?
Post by: Hapax on February 01, 2016, 06:47:17 pm
If you are unable to upgrade, sf::thread can be useful. SFML 2 itself uses it (as it can't use C++11 yet)  ;)

SFML 3 is in the pre-development discussion and planning stage. It's a very long way away. You may be interested in this thread (http://en.sfml-dev.org/forums/index.php?topic=15027.0) (the latest one I could find but shows how long these things take).
Title: Re: How do std::thread and sf::thread compare ?
Post by: Satus on February 02, 2016, 11:48:28 am
Quote
My compiler supports C++11... except thread.

Why don't you use Visual Studio 2015 compiler on Windows?