• Kenton Varda's avatar
    Implement fibers on Unix. · e8a14a7a
    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
..
compat Loading commit data...
parse Loading commit data...
std Loading commit data...
CMakeLists.txt Loading commit data...
arena-test.c++ Loading commit data...
arena.c++ Loading commit data...
arena.h Loading commit data...
array-test.c++ Loading commit data...
array.c++ Loading commit data...
array.h Loading commit data...
async-inl.h Loading commit data...
async-io-internal.h Loading commit data...
async-io-test.c++ Loading commit data...
async-io-unix.c++ Loading commit data...
async-io-win32.c++ Loading commit data...
async-io.c++ Loading commit data...
async-io.h Loading commit data...
async-prelude.h Loading commit data...
async-test.c++ Loading commit data...
async-unix-test.c++ Loading commit data...
async-unix-xthread-test.c++ Loading commit data...
async-unix.c++ Loading commit data...
async-unix.h Loading commit data...
async-win32-test.c++ Loading commit data...
async-win32-xthread-test.c++ Loading commit data...
async-win32.c++ Loading commit data...
async-win32.h Loading commit data...
async-xthread-test.c++ Loading commit data...
async.c++ Loading commit data...
async.h Loading commit data...
common-test.c++ Loading commit data...
common.c++ Loading commit data...
common.h Loading commit data...
debug-test.c++ Loading commit data...
debug.c++ Loading commit data...
debug.h Loading commit data...
encoding-test.c++ Loading commit data...
encoding.c++ Loading commit data...
encoding.h Loading commit data...
exception-test.c++ Loading commit data...
exception.c++ Loading commit data...
exception.h Loading commit data...
filesystem-disk-generic-test.c++ Loading commit data...
filesystem-disk-old-kernel-test.c++ Loading commit data...
filesystem-disk-test.c++ Loading commit data...
filesystem-disk-unix.c++ Loading commit data...
filesystem-disk-win32.c++ Loading commit data...
filesystem-test.c++ Loading commit data...
filesystem.c++ Loading commit data...
filesystem.h Loading commit data...
function-test.c++ Loading commit data...
function.h Loading commit data...
hash.c++ Loading commit data...
hash.h Loading commit data...
io-test.c++ Loading commit data...
io.c++ Loading commit data...
io.h Loading commit data...
main.c++ Loading commit data...
main.h Loading commit data...
map-test.c++ Loading commit data...
map.h Loading commit data...
memory-test.c++ Loading commit data...
memory.c++ Loading commit data...
memory.h Loading commit data...
miniposix.h Loading commit data...
mutex-test.c++ Loading commit data...
mutex.c++ Loading commit data...
mutex.h Loading commit data...
one-of-test.c++ Loading commit data...
one-of.h Loading commit data...
refcount-test.c++ Loading commit data...
refcount.c++ Loading commit data...
refcount.h Loading commit data...
string-test.c++ Loading commit data...
string-tree-test.c++ Loading commit data...
string-tree.c++ Loading commit data...
string-tree.h Loading commit data...
string.c++ Loading commit data...
string.h Loading commit data...
table-test.c++ Loading commit data...
table.c++ Loading commit data...
table.h Loading commit data...
test-helpers.c++ Loading commit data...
test-test.c++ Loading commit data...
test.c++ Loading commit data...
test.h Loading commit data...
thread-test.c++ Loading commit data...
thread.c++ Loading commit data...
thread.h Loading commit data...
threadlocal-pthread-test.c++ Loading commit data...
threadlocal-test.c++ Loading commit data...
threadlocal.h Loading commit data...
time-test.c++ Loading commit data...
time.c++ Loading commit data...
time.h Loading commit data...
timer.c++ Loading commit data...
timer.h Loading commit data...
tuple-test.c++ Loading commit data...
tuple.h Loading commit data...
units-test.c++ Loading commit data...
units.c++ Loading commit data...
units.h Loading commit data...
vector.h Loading commit data...
windows-sanity.h Loading commit data...