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

Author Topic: How do std::thread and sf::thread compare ?  (Read 4196 times)

0 Members and 1 Guest are viewing this topic.

bisthebis

  • Newbie
  • *
  • Posts: 19
    • View Profile
How do std::thread and sf::thread compare ?
« 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 ?

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: How do std::thread and sf::thread compare ?
« Reply #1 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

bisthebis

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: How do std::thread and sf::thread compare ?
« Reply #2 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 ?

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: How do std::thread and sf::thread compare ?
« Reply #3 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 (the latest one I could find but shows how long these things take).
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Satus

  • Guest
Re: How do std::thread and sf::thread compare ?
« Reply #4 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?

 

anything