My goal is to write a program that handles an arbitrary number of tasks based on given user input. 

**Let's say the # of tasks are 1000 in this case.**

Now, I'd like to be able to have a dynamic number of threads that are spawned and start handling the tasks one by one.

I would assume I need to use a "synchronous" method, as opposed to a "asynchronous" one, so that in case one tasks has a problem, I wouldn't want it to slow down the completion of the rest.

What method would I use to accomplish the above? Semaphores? ThreadPools? And how do I make sure that a thread does not try to start a task that is already being handled by another thread? Would a "lock" handle this?

Code examples and/or links to sites that will point me in the right direction will be appreciated.

**edit:** The problem with the MSDN Fibonacci example is that the waitall method can only handle up to 64 waits. I need more than that due to the 1000 tasks. How to fix that situation without creating deadlocks?