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
yadavdepAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
käµfm³d 👽Connect With a Mentor Commented:
Try removing:

thread.IsBackground = true;

Open in new window


http://msdn.microsoft.com/en-us/library/h339syd0.aspx
0
 
yadavdepAuthor Commented:
what if I set the thread priority to highest
0
 
deepu chandranCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.