How a Future proceeds
-
The future object is registered in an internal array.
-
The code related to the future is registered in the event queue.
-
An empty future object is returned.
-
All the code that has to run synchronously runs
-
Once everything has run, the remaining actual data is delivered to the future
Async method : always returns a future (main method seems to be the exception)
- Code runs synchronously until it hits await
- When it hits await, it returns an empty future type and waits until the function in await finishes
- When that finishes, the next code runs