# The correct (and elegant) way to call async functions in Swift6 and more

**URL:** <https://forums.swift.org/t/the-correct-and-elegant-way-to-call-async-functions-in-swift6-and-more/78262>\
**Category:** Using Swift\
**Tags:** concurrency, swiftui\
**Created:** [March 4, 2025, 1:20am UTC](https://forums.swift.org/t/the-correct-and-elegant-way-to-call-async-functions-in-swift6-and-more/78262 "2025-03-04T01:20:52Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [March 8, 2025, 7:07am UTC](https://forums.swift.org/t/the-correct-and-elegant-way-to-call-async-functions-in-swift6-and-more/78262/5 "2025-03-08T07:07:18Z")

</div>

You're likely overloading Swift's fixed-width thread pool used to run all concurrency work. With it generating thousands of thumbnails, there's not enough capacity left to let other work proper resume or suspend, leading to the UI issues you see. Unfortunately Swift doesn't allow you to throw the work into a separate thread pool unless do it yourself, like wrapping `DispatchQueue.concurrentPerform`, which would help. If you want to stay within Swift Concurrency you can try inserting `Task.yield()` at the end of every bit of work (or batch of work) to give the concurrency system a bit of time to process other work, but you'll want benchmark and see how yielding after every thumbnail or a particular number of thumbnails affects your overall performance.

This is definitely an area I'd like to see improved but I lost the pitch I was writing. It's probably a good followup to the recent default executor proposals.

Edit: found my draft pitch, [[Prepitch]: Scoped, Fixed Width Concurrency Executors](https://forums.swift.org/t/prepitch-scoped-fixed-width-concurrency-executors/78374)

---

_[View the full topic](https://forums.swift.org/t/the-correct-and-elegant-way-to-call-async-functions-in-swift6-and-more/78262)._
