Reputation:
What is the maximum number of threads you can create in a C# application for Windows 8 Metro UI? And what happens when you reach this limit? Is an exception of some kind thrown?
Upvotes: 3
Views: 250
Reputation: 54801
Before you even create a single Thread, ask yourself if you can use the threadpool.
Upvotes: 1
Reputation: 27632
I think that there is no limit. The maximum number of threads is determined by the amount of resources available.
And, as Henk said, if you need to ask what the maximum number of threads is, you are probably doing something wrong.
Upvotes: 2
Reputation: 273591
Threads are very expensive objects. You ought to focus on creating as few as possible.
what happens when you reach this limit?
Your PC will slow down long before you reach this limit.
Is an exception of some kind thrown?
OOM is most likely, unless the user throws the PC out the window first.
Upvotes: 4