.NET Thread Pool - Unresponsive WinForms UI
Posted
by Goober
on Stack Overflow
See other posts from Stack Overflow
or by Goober
Published on 2010-03-23T16:05:15Z
Indexed on
2010/03/23
16:33 UTC
Read the original article
Hit count: 453
Scenario
I have a Windows Forms Application. Inside the main form there is a loop that iterates around 3000 times, Creating a new instance of a class on a new thread to perform some calculations. Bearing in mind that this setup uses a Thread Pool, the UI does stay responsive when there are only around 100 iterations of this loop (100 Assets to process). But as soon as this number begins to increase heavily, the UI locks up into eggtimer mode and the thus the log that is writing out to the listbox on the form becomes unreadable.
Question
Am I right in thinking that the best way around this is to use a Background Worker? And is the UI locking up because even though I'm using lots of different threads (for speed), the UI itself is not on its own separate thread?
Suggested Implementations greatly appreciated.
© Stack Overflow or respective owner