I am working on a project that collects (1000+) data points from a database and updates itself every few seconds. To keep my main thread from locking, I have to read, sort, and save data in a background thread. I would like to understand the difference between two background calls.
In this article the author gives us a good example of using a background thread like so: DispatchQueue(label: "foo", qos: .utility).async {}
In another example on this site, I found a great example of an extension of DispatchQueue
. This one does not use a label.
I know these two methods are different but how exactly (other than one being an extension)? Second question: is it best practice to wait for a background thread activity to finish its job before calling it again? Or does that matter?