-
Kenton Varda authored
Fibers allow code to be written in a synchronous / blocking style while running inside the KJ event loop, by executing the code on an alternate call stack and switching back to the main stack whenever it waits. We introduce a new function, `kj::startFiber(stackSize, func)`. `func` is executed on the fiber stack. It is passed as its parameter a `WaitScope&`, which can then be passed into the `.wait()` method of any promise in order to wait on the promise in a blocking style. `startFiber()` returns a promise for the eventual value returned by `func()` (much as `evalLater()` and friends do). This commit implements fibers on Unix via ucontext_t. Windows will come next (and will probably be easier...).
e8a14a7a
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
cmake | ||
ekam-provider | ||
m4 | ||
pkgconfig | ||
samples | ||
src | ||
CMakeLists.txt | ||
LICENSE.txt | ||
Makefile.am | ||
Makefile.ekam | ||
README.txt | ||
afl-fuzz.sh | ||
configure.ac | ||
regenerate-bootstraps.sh | ||
setup-autotools.sh | ||
setup-ekam.sh |