Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-15308] async let works incorrectly on Simulators #57630

Open
swift-ci opened this issue Oct 12, 2021 · 0 comments
Open

[SR-15308] async let works incorrectly on Simulators #57630

swift-ci opened this issue Oct 12, 2021 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-15308
Radar None
Original Reporter barn.gumbl (JIRA User)
Type Bug
Environment
  • MacOS 11.4, Xcode 13.0, iPhone 13 Pro Max and iPhone 12 Prod Max Simulators
  • iPhone 7 iOS 15.0.1
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: beaa32d79fea65f9cba3a9fe06093662

Issue Description:

I run the following code snippet

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        Task {
            async let networkData = loadFromNetwork()
            async let dbData = loadFromDB()
            await print("\(networkData) \(dbData)")
        }
    }
}
func loadFromNetwork() async -> String {
    print("loadFromNetwork started \(Thread.current)")
    (0...10000000).forEach { String($0) }
    print("loadFromNetwork finished")
    return "Network Data"
}
 
func loadFromDB() async -> String {
    print("loadFromDB started \(Thread.current)")
    (0...10000000).forEach { String($0) }
    print("loadFromDB finished")
    return "DB Data"
}

The result is the following on iPhone 7 (iOS 15) (expected result)

loadFromNetwork started <NSThread: 0x2818ace40>{number = 6, name = (null)}
loadFromDB started <NSThread: 0x2818a0d80>{number = 4, name = (null)}
loadFromNetwork finished
loadFromDB finished
Network Data DB Data

The result is the following on iPhone 13 Pro Max and iPhone 12 Prod Max Simulators (unexpected result)

loadFromNetwork started <NSThread: 0x600001528a00>{number = 7, name = (null)}
loadFromNetwork finished
loadFromDB started <NSThread: 0x600001528a00>{number = 7, name = (null)}
loadFromDB finished
Network Data DB Data
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant