Merge pull request #1438 from vaci/vaci/defer-cancel

allow defer to be cancelled
diff --git a/c++/src/kj/common.h b/c++/src/kj/common.h
index 34e40d4..d1694d6 100644
--- a/c++/src/kj/common.h
+++ b/c++/src/kj/common.h
@@ -1869,9 +1869,14 @@
   KJ_DISALLOW_COPY(Deferred);
 
   // This move constructor is usually optimized away by the compiler.
-  inline Deferred(Deferred&& other): func(kj::fwd<Func>(other.func)), canceled(false) {
+  inline Deferred(Deferred&& other): func(kj::fwd<Func>(other.func)), canceled(other.canceled) {
     other.canceled = true;
   }
+
+  void cancel() {
+    canceled = true;
+  }
+
 private:
   Func func;
   bool canceled;