Link to home
Start Free TrialLog in
Avatar of yadavdep
yadavdepFlag for India

asked on

Thread was being aborted for a background thread

I am running a long process which imports a long csv list into database in a separate thread

threadStart = new ThreadStart(processCSVUsers);
            thread = new Thread(threadStart);
            thread.IsBackground = true;        
            thread.Start();


but I am facing one issue, if I run to many applications on this same pc then some times I am getting "Thread was being aborted." exception.

what I can do to make sure that this process always finsihs
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yadavdep

ASKER

what if I set the thread priority to highest
Hi,

With in your processCSVUsers function , lock  your CSV read object and try

Refer below article
http://msdn.microsoft.com/en-us/library/c5kehkcz(v=vs.80).aspx

-- Deepu