Async tasks and cancellation

Can the timer waits overlap?

Examples

Worked example

Input
Two tasks each await a one-second timer and are started together.
Expected output
Yes.

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

Each task gives control back to the event loop while it waits, so the other task can wait during the same time.

Back to the lesson