Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 678 Bytes

08.-concurrency.md

File metadata and controls

29 lines (23 loc) · 678 Bytes
description
8.1 Don’t Decorate Functions with Async

08. Concurrency

  • Avoid decorating <suspends> functions with Async 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()