title: DispatchQueue.global(qos: .default) continues when app is backgrounded or screen locked, how to suspend?
body: <p>Swift Newbie: porting Objective-C AppleHealth integration code to Swift that is invoked by Flutter/Dart. When I background or lock-screen the legacy Obj-C app, it pretty much immediately suspends all execution.
  However the same behaviour doesn't happen in my Swift code port, I'm using the same DispatchQueue in Swift as in the legacy Obj-C app,</p>
  
  <p>The reason it's important to suspend, is that once a user locks the iPhone screen, AppleHealth encrypts all its data and it is unavailable. 
  Also is my understanding correct that when you suspend a DispatchQueue the currently executing block will complete, but subsequents blocks won't start execution.
  As far as I can tell my, Swift code port mimics the Obj-C logic, any hints as to why it behaves differently or what I may be missing would be greatly appreciated.</p>
  
  <p>I'm dispatching using </p>
  
  <pre><code>DispatchQueue.global(qos: .default).async { 
  /* code */ 
  }
  </code></pre>
  
  <p>If could get the new app to immediately suspend all executing code I submitted to the DispatchQueue, when backgrounded or lock-screened I would be extremely happy.</p>