Hello!
I have this code:
Thread[] array = new Thread[size];
Checker[] myclass = new Checker[size];
ThreadStart[] startth = new ThreadStart[size];
int limit = totalitem / size;
for (int k = 0; k < size; k++)
{
myclass[k] = new Checker(this);
myclass[k].pattern = pattern;
startth[k] = delegate { myclass[k].DoChecking(limit * k, url_list, size); };
array[k] = new Thread(startth[k]);
array[k].IsBackground = true;
array[k].Start();
Thread.Sleep(100);
if (!array[k].IsAlive)
{
array[k].Join();
}
}
But when I run it UI crashes so it's no good. Do you have any idea how I can run same code, but in background so it wont use UI thread and doesn't crash UI.