title: N number of threads asynchronously getting/executing tasks
body: <p>I have an unlimited number of tasks in a db queue somewhere.  What is the best way to have a program working on n tasks simultaneously on n different threads, starting new tasks as old ones get done?  When one task finishes, another task should asynchronously begin.  The currently-running count should always be n.</p>
  
  <p>My initial thought was to use a thread pool, but that seems unnecessary considering that the tasks to be worked on will be retrieved within the individual threads.  In other words, each thread will on its own go get its next task rather than having a main thread get tasks and then distribute them.</p>
  
  <p>I see multiple options for doing this, and I don't know which one I should use for optimal performance.</p>
  
  <p>1) Thread Pool - In light of there not necessarily being any waiting threads, I'm not sure this is necessary.</p>
  
  <p>2) Semaphore - Same as 1.  What's the benefit of a semaphore if there aren't tasks waiting to be allocated by the main thread?</p>
  
  <p>3) Same Threads Forever - Kick the program off with n threads.  When a thread is done working, it gets the next task itself.  The main thread just monitors to makes sure the n threads are still alive.</p>
  
  <p>4) Event Handling - Same as 3, except that when a thread finishes a task, it fires off an ImFinished event before dying.  An ImFinished event handler kicks off a new thread.  This seems just like 3 but with more overhead (since new threads are constantly being created)</p>
  
  <p>5) Something else?</p>