Open henish opened 7 years ago
I'd say the example is misleading, but it does actually work properly without join
. Since quads
doesn't await
anything, it finishes completely before control returns to the calling scope — it is "eagerly executed". In the end, the program is optimized such that there is no concurrency.
@acrylic-origami is right in that it correctly runs because it is eagerly executed. It would be more correct to join the result. This way the await handle is not orphaned, and possibly never executed.
To clarify: HHVM does not run your code in parallel when you use async and await. It simply allows IO calls (like requests to a database) to be asynchronous. This means they can happen in the background and in parallel with other background tasks while your code continues to run. A well documented explanation is on the docs site.
Please complete the information below:
Where is the problem?
In the example code which has the function 'quads_m()'
What is the problem?
I would expect the 'quads_m()' function to be 'await'ed or in this case 'join'ed since it is an asyn function
Please don't change anything below this point.