jimweirich/rake — pull request #139 by michaeljbishop (2012-10-28 02:42:00+00:00)
Title: ThreadPool no longer creates new threads to compensate for threads sleeping on futures

This is an interesting, but still experimental version of the ThreadPool in
which the thread pool no longer needs to create new threads to
compensate for the imminent sleep of a thread on a future.

Previously, the ThreadPool created futures and added them to the queue.
If, when they processed a future and they had to wait for it to
finish executing, they would spawn another thread so they could
wait for the future.

Now, a non-blocking attempt to process the future's block is what is
put on the queue and a blocking attempt is passed back from #future.
In this way, the thread pool is free to process the core of a future
by dequeuing it and calling it. The the thread can't get the lock, it
is assumed that another thread is handling it and so it moves to
the next.