reactphp/promise — pull request #20 by jsor (2014-10-04 11:00:36+00:00)
Title: Cancellable promise

Added [CancellablePromiseInterface](https://github.com/reactphp/promise/tree/cancellable-promise#cancellablepromiseinterface) implemented by all promises.

__Note on the implementation:__

The `$canceller` callback is responsible for rejecting the promise, there is no automatic rejection mechanism (See https://github.com/reactphp/promise/tree/cancellable-promise#promise-1).

The `$canceller` callback is invoked only, if `cancel()` is called either on the root promise or on __all__ derived promises.

Called on root promise
```php

$promise = getCancellablePromise();

$promise->cancel(); // Promise is cancelled.
```

Called on derived promises
```php
$promise = getCancellablePromise();

$derived1 = $promise->then();
$derived2 = $promise->then();

$derived1->cancel(); // $promises is not cancelled
$derived2->cancel(); // $promises is cancelled
```