Concurrency / Parallelism
Ki's approach to concurrency and parallelism is rather low-level. Functions
can be defined as async
, meaning they will be spawned in a separate thread.
async
functions have the two additional restrictions:
async
/gen
functions cannot accept references
A reference's underlying memory may be deallocated while the async
/gen
function is running, so it cannot accept reference arguments.
async
Functions Don't Have Return Values
async
functions have their own return value: thread
. Starting a thread
can cause an error
though, so that has to be wrapped in iferr
.