title: misunderstanding of concurrentQueue, a single consumer working from the queue on it's own thread
body: <p>I'm having trouble creating a functioning SystemFileWatcher that takes the created event and stores it in a queue for a separate thread to work from. I've read countless threads here regarding this issue but I can't get my head around this particular problem. </p>
  
  <pre><code>using System;
  using System.IO;
  using System.Collections.Generic;
  using System.Collections.Concurrent;
  using System.Collections;
  using System.Threading;
  
  namespace FileSystemWatcherTest
  {
      class Program
      {
          public static BlockingCollection&lt;string&gt; processCollection = new BlockingCollection&lt;string&gt;(new ConcurrentQueue&lt;string&gt;());
  
      static void Main(string[] args)
      {
          string path = @"C:\test\";
          FileSystemWatcher watcher = new FileSystemWatcher();
  
          watcher.Path = path;
          watcher.EnableRaisingEvents = true;
          watcher.Filter = "*.*";
  
          watcher.Created += new FileSystemEventHandler(onCreated);
          Thread Consumer = new Thread(new ThreadStart(mover));
          Consumer.Start();
  
  
          while (true) ;//run infinite loop so program doesn't terminate untill we force it.
      }
      static void onCreated(object sender, FileSystemEventArgs e)
      {
          processCollection.Add(e.FullPath);     
      }
  
      static void mover()
      {
          string current;
          string processed = @"C:\test\processed\";
          while (true)
          {
              while (processCollection.IsCompleted)
              {
                  Thread.Sleep(1000);
              }
              while (processCollection.TryTake(out current))
              {
                  System.IO.File.Move(current, processed);
              }
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is what I'd like to test. I'm aware this does not work. I've verified the FSW works when I'm simply writing to console when a file is placed inside the queue. My problem begins around when I try to start the mover function in it's own thread. The mover function and onCreated do not appear to communicate once I start working off the queue.  </p>
  
  <p>My expectation of this code is to start the mover function in it's own thread and run it alongside the SFW. My expectation is that the concurrentqueue attached to the blockingcollection auto updates (I enqueue an item through onCreated, the mover sees that it now has +1 to that queue. The mover takes one from the queue, the onCreated sees this.) I'm probably using the Thread.Sleep incorrectly. I no longer have a supporting reason for using blockingcollection (which I chose at first to handle waiting for the queue to fill up and, basically, constantly check the queue for an item to process) and am open to changing this to whatever might work. I've seen use of locks, but from what I understand this is not really necessary due to how concurrentQueue synchronizes.</p>
  
  <p>The ultimate goal is to process large quantities of small files that come in at random times and can range from 1 to several hundred at any given time. These files are .EMLs.</p>
  
  <p>If at all possible, I would greatly appreciate an explanation of what is happening and what a suggestion would be to get around this problem. I come humbly and expect to be told everything I understand is incorrect!</p>
  
  <p>edit: I'm testing this as a console application but it will be used as a service afterwards. I added the while (true) ; before onCreated() to keep FSW running.</p>