I have a Windows forms app which spawns 24 threads, each of which reads data from a text file on a remote server and populates a database with the contents. Each thread loops at a set interval until a flag is changed to stop the data collection.
My problem is that it seems that the FileIO.TextFieldParser
call is locking up the UI slightly. Sometimes up to a second or 2. This seems very strange to me but if I remove that part of the code, there is no UI interference. Add it back in and it returns...
EDIT: I've tried it with File.ReadAllLines
and it's still happening
Any ideas whats going on here? Also, is there any way to profile the UI thread to confirm that this is/isn't the problem.
Thread spawning is done as follows:
Dim thPoll = New Thread(Sub() mc.CollectData())
thPoll.Name = "ip_" & mc.IP
thPoll.IsBackground = True
thPoll.Priority = ThreadPriority.BelowNormal
thPoll.Start()