08. Concurrency
8.1 Don’t Decorate Functions with Async
Avoid decorating
<suspends>functions withAsyncor similar terms.Do:
DoWork()<suspends>:voidDon't:
DoWorkAsync()<suspends>:voidIt’s acceptable to add the
Awaitprefix 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?