Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

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
0
yadavdep
Asked:
yadavdep
1 Solution
 
käµfm³d 👽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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now