Commit 382d9930 authored by Kenton Varda's avatar Kenton Varda Committed by GitHub

Merge pull request #436 from ryanofsky/pr/lazy

doc/cxxrpc: Document lazy execution
parents 548f1f63 ec0f87e6
......@@ -154,6 +154,18 @@ callbacks simply won't be executed. If you need explicit notification when a pr
you can use its `attach()` method to attach an object with a destructor -- the destructor will be
called when the promise either completes or is canceled.
### Lazy Execution
Callbacks registered with `.then()` which aren't themselves asynchronous (i.e. they return a value,
not a promise) won't be executed by default. There are several ways to force a promise to execute
eagerly:
* `.wait()` on it.
* `.detach()` it.
* Add it to a `kj::TaskSet` (this is a lot like `detach()`, except that you can cancel all tasks in
the set by destroying the set).
* Call `.eagerlyEvaluate()` on it.
### Other Features
KJ supports a number of primitive operations that can be performed on promises. The complete API
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment