title: Thread.abort() and Thread.join() taking long time in c# windows applications
body: <p>In my c# windows application,</p>
  
  <p>I have two buttons export and cancel.</p>
  
  <p>In my export button, here i am exporting sql datatable to .csv file.its running under the thread.</p>
  
  <pre><code>thrThreadExportProcess = new Thread(new ThreadStart(startExport));
             thrThreadExportProcess.Start();
             thrThreadExportProcess.IsBackground = true;
  </code></pre>
  
  <p>while its exporting process is running, user hits the cancel button here i am aborting the thread,then joining the thread and deleting the exported file.</p>
  
  <p>while its joining Thread, application get hangs up some time then it will run.</p>
  
  <p>my question is why its hangs up some time.</p>
  
  <p>here is the part of the code in cancel button.</p>
  
  <pre><code>if (thrThreadExportProcess.IsAlive)
              {
                 thrThreadExportProcess.Abort();
                 thrThreadExportProcess.Join();
                 File.Delete(csvPath);
              }
  </code></pre>
  
  <p>Kindly provide your valuble Suggestions.</p>