Issue 19 of 30 Days of Hack (HHVM)

There is built in support for asynchronous programming in Hack. You have to declare a function as async with a return value of Awaitable. When you call that function it will return immediately. When you need the return value you call the function join() to force the execution of the async function.
There is not much documentation on the async programming on the hacklang website or around the Internet. I believe the core hack team need to do some more work on this feature before it gets production ready.
On the Happyr developer blog there are two examples of how you can use asynchronous programming. One example uses GenVectorWaitHandle to stack up asynchronous calls and execute them all at once. Read the article here.
Tired of waiting for the next lesson?
Read next lesson straight away by upgrading to premium today.
Upgrade to premium Sign in