There are 2 kinds of sleep, one for the thread (you are using this one)
https://developer.apple.com/documentation/foundation/thread/1413673-sleep
and the one that shouldmust be used in concurrency.
https://developer.apple.com/documentation/swift/task/sleep(_:)
private func bar() -> AsyncStream<String> { return AsyncStream { continuation in let task = Task{ print("Stream Started") for count in 0...2 { //Concurrency version of sleeping try await Task.sleep(for: .seconds(1)) print("Yielding...") continuation.yield("\(count)") } continuation.finish() } continuation.onTermination = { _ in //Make sure you cancel the task if the stream is terminated task.cancel() } } } Concurrency isn't directly related to threads, it is more about "Actors"