Reputation: 11
I am making a program for days but nothing seems to be working. I want to run (n threads=user sepecified threads ie 1-100) on a listview which has 1st field as email (the list is of 10000 records). Now I want to verify each email and add on the 2nd column the thread id and on the third column the result whether the email is valid or not can anybody help me? With some code and explanation. thanx
Upvotes: 1
Views: 116
Reputation: 273314
First of all, don't use a ListView as a datastructure. Bind it to some List<MyClass>
.
Then run your Threads on the ThreadPool (<= .NET 3.5) or using Tasks (.NET4).
The learn about accessing your List<> in a thread-safe way. And then update your ListView using Control.Invoke(), or from a Timer
Upvotes: 2
Reputation: 15391
This sounds like a task for the Task Parallel Library. Rather than managing your threads by hand, it provides you with higher-level constructs which will properly use the thread pool and the hardware you have available, and parallelize work.
Upvotes: 1