Require Promise::setResult to be called as r-value

The setResult member function should be called only in r-value context
like other member functions.
Invalidate Promise before calling callback

Previously, when a result is set to a promise, the result was set to the
delay object and then the promise (delay holder) was invalidated. Which
means the corresponding callback function, if any, was being called
before the promise is invalidated. This may possibly lead to an
undefined behavior if the callback function accesses the promise. To
avoid the problem, the promise should be invalidated before the result
is set to the delay.
Invalidate Future before calling callback

Previously, when a callback function is set to a future, the callback
was set to the delay object and then the future (delay holder) was
invalidated. Which means the callback was being called before the future
is invalidated. This may possibly lead to an undefined behavior if the
callback accesses the future. To avoid the problem, the future should be
invalidated before the callback is set to the delay.
Simplify createFuture implementation
Merge pull request #113 from magicant/feature/async

Future implementation enhancement
Add WriterApi abstract class
Allow cast NonBlockingFileDescriptor -> FileDescriptor
Add copy function
Add write function