ThreadPool explosion
-
Whereas the number of threads should be known in advance, the architecture of this application is so bad, that this check has been added before launching new threads, to avoid the ThreadPool to explode :
var count = Process.GetCurrentProcess().Threads.Count;
if (count > maxApplicationThreadCount) return;Cheers :cool:
-
Whereas the number of threads should be known in advance, the architecture of this application is so bad, that this check has been added before launching new threads, to avoid the ThreadPool to explode :
var count = Process.GetCurrentProcess().Threads.Count;
if (count > maxApplicationThreadCount) return;Cheers :cool:
Well, having a lot of threads isn't necessarily a bad thing. It depends on what they're doing. If they're sitting around waiting for some async process to complete, then should be OK. But if they're all competing for CPU time doing heavy processing, then yeah, that's not good. Marc
-
Whereas the number of threads should be known in advance, the architecture of this application is so bad, that this check has been added before launching new threads, to avoid the ThreadPool to explode :
var count = Process.GetCurrentProcess().Threads.Count;
if (count > maxApplicationThreadCount) return;Cheers :cool:
Also nice to note that it prevents the creation of new threads only after the maximum number has been exceeded...
-
Whereas the number of threads should be known in advance, the architecture of this application is so bad, that this check has been added before launching new threads, to avoid the ThreadPool to explode :
var count = Process.GetCurrentProcess().Threads.Count;
if (count > maxApplicationThreadCount) return;Cheers :cool:
...which also implies that there is no feedback to the calling function whether the new thread has been started, or not. Interesting, at least. :)
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.
-
...which also implies that there is no feedback to the calling function whether the new thread has been started, or not. Interesting, at least. :)
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.
Well, it's a timer (that is never stopped) that creates a worker thread in its callback method, so if there is too much threads, then... no work will be started. This check has been added because the duration of the worker thread was sometimes longer than the timer interval, so the number of threads was increasing indefinitely ! :wtf:
-
Well, it's a timer (that is never stopped) that creates a worker thread in its callback method, so if there is too much threads, then... no work will be started. This check has been added because the duration of the worker thread was sometimes longer than the timer interval, so the number of threads was increasing indefinitely ! :wtf: