08. Concurrency
8.1 Don’t Decorate Functions with Async
Avoid decorating
<suspends>
functions withAsync
or similar terms.Do:
DoWork()<suspends>:void
Don't:
DoWorkAsync()<suspends>:void
It’s acceptable to add the
Await
prefix to a<suspends>
function that internally waits on something to happen. This can clarify how an API is supposed to be used.AwaitGameEnd()<suspends>:void= # Setup other things before awaiting game end… GameEndEvent.Await() OnBegin()<suspends>:void = race: RunGameLoop() AwaitGameEnd()
Was this helpful?