Is there any practical use for running asynchronous tasks in a serial queue?

Is there any practical use for running asynchronous tasks in a serial queue, if the asynchronous tasks have to wait its turn anyways and once a task starts, it doesn’t stop until it is finished. Do I understand that correctly?

2 Likes

The queue determines whether you can run one job at a time or multiple. The sync/async determines what your current thread does. So you may want to stick 20 jobs into a serial queue so that only one runs at a time. However, you don’t want to wait for any of those jobs to complete on the current thread, because you’re going to go do something else. So you submit them to that queue as async so the current thread keeps going. You’ve now got 20 jobs in the queue that will run one at a time, sequentially, but you’re off doing other UI related work, for example.

2 Likes

Yeah! That makes good sense. Thank you.

Best answer I’ve ever read about this! :clap: