bhuga/promising-future — pull request #8 by michaeljbishop (2012-10-14 00:39:03+00:00)
Title: Added __worker__ method

Hi Ben,

As promised, here is a revised version of the thread-pool support. It doesn't implement a thread-pool, but it allows the `Promise` class to be adapted to any thread pool any other author would write.

The addition is a single method: `Promise#__worker__` which returns a proc that can be handed off to a queue in a thread pool.

I've added documentation for how it would work, but it basically looks like this:

p = promise { 3 + 3 }
pool.queue << p.__worker__ # add the worker to a queue so processing will immediately start

... later ...

p.__force__

I hope this is a small enough change that you would still consider the library tidy. I think this would enhance the `Promise` class a great deal.

Sincerely,

_ michael