-
-
Notifications
You must be signed in to change notification settings - Fork 5
thread
pannous edited this page Sep 19, 2021
·
5 revisions
async threading follows the go/zig path to be invoked on the caller side.
On the callee side, functions are agnostic whether they are called in a synchronous or asynchronous way.
This way function coloring and the huge syntactic and semantic async/await overhead mess is avoided:
go { sleep 1s and print "second"; done = true }
print "first"
last = after done return "third"
cancel last
// print last // warning: last is optional and asynchronous
print await last or "no third"
The after keyword creates an (aspect oriented) implicit signal listener on the variable done