SFML community forums

Help => System => Topic started by: Neomex on December 30, 2011, 07:08:13 pm

Title: How many threads can single application handle?
Post by: Neomex on December 30, 2011, 07:08:13 pm
How many threads can single application handle?
Is there some limit, might they slow program down?
Title: How many threads can single application handle?
Post by: Laurent on December 30, 2011, 07:46:18 pm
The limit depends on the OS. But if you ask this question, it means that you're doing something wrong: the more threads you spawn, the slower your program becomes. You should have only a few threads, and only if they are really necessary (beginners tend to overuse them).
Title: How many threads can single application handle?
Post by: Neomex on December 30, 2011, 08:52:53 pm
Didn't implemented any yet, but considered to use them in few places like loading files and displaying graphics at the same time. Also, do clocks use different threads for measuring time?
Title: How many threads can single application handle?
Post by: Laurent on December 30, 2011, 10:40:01 pm
Quote
displaying graphics at the same time

Don't create multiple rendering threads, it won't work.

Quote
Also, do clocks use different threads for measuring time?

No.
Title: How many threads can single application handle?
Post by: TechRogue on January 17, 2012, 07:02:14 pm
Quote
Don't create multiple rendering threads, it won't work.


I believe the intent here is to load resources while displaying a progress bar or something.
Title: How many threads can single application handle?
Post by: tobybear on January 18, 2012, 09:18:03 am
For Windows, see also this MSDN post:
http://blogs.msdn.com/b/oldnewthing/archive/2005/07/29/444912.aspx
But the real question that is raised whenever somebody asks, "What's the maximum number of threads that a process can create?" is "Why are you creating so many threads that this even becomes an issue?"