title: Thread has exited with code 0 but not finished it's work
body: <p>I'm kinda new to multi- threading in C# and would like to know why is this behavior happening:</p>
  
  <p><strong>I have thread 1 to load files asynchronously. Thread 2 is meant to always check if thread is still running and if thread 1 stopped running that it should update UI.</strong> </p>
  
  <p>Now, I know there are better ways to achieve what I want using Tasks or other mechanisms, but once I encounter this issue I need to know what am I doing wrong using this implementation first, before learning the better ways to do it. </p>
  
  <p><strong>The problem is that sometimes it executes perfectly fine and at other times the threads just exit with code 0 without updating my UI to notify it finished working.</strong></p>
  
  <p>actual code:</p>
  
  <pre><code> // Call File Manager (singleton) Async file loader method from the MainWindow.cs class
      fm.loadFromDirAsync(new DirectoryInfo(dialog.SelectedPath));
  
  
   // This method is in the File Manager singleton class
  public void loadFromDirAsync(DirectoryInfo di)
  {
      loadFiles = new Thread(() =&gt; FullDirList(di, "*.mp3"));
      loadFiles.Start();
      loadFiles.Name = "loadFromDirAsync";
  
  }
  
  // Back to MainWindow class, start a new thread to check if the async load thread 
     is still running:
  
            // Check if finished loading
      Thread t = new Thread(() =&gt; load());
      t.Start();
      t.Name = "LoaderThread";
  
  
  // this method (in MainWindow class) checks if the loader thread in File Manager is still alive:
             private void load()
  {
      while (runCheck)
      {
  
          // If Async file loading thread finished...
          if (!fm.isThreadStillLoading())
          {
              Console.WriteLine("Done running");
  
              Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
               new Action(
          delegate()
          {
              loadBTN.IsEnabled = true;
              pb.IsIndeterminate = false;
              pb.IsEnabled = false;
              runCheck = false;
              pbLabel.Content = string.Format("Finished Indexing {0} files in {1} folder - Ready to play.", fm.filesCount, fm.foldersCount);
  
          }
           ));
  
          }
      }
  }
  </code></pre>