Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 티스토리챌린지
- modern concurrency
- 야곰 # 야곰아카데미커리어스타터캠프 #iOS개발자 # 부트캠프
- ios
- modern concurrency deep dive
- 오블완
- SWIFT
- WWDC
- APNS
Archives
- Today
- Total
Geon
Modern Concurrency Deep Dive(8) 본문
iOS developer essential skills/Modern Concurency
Modern Concurrency Deep Dive(8)
jgkim1008 2024. 11. 21. 22:31
TaskGroup
await withTaskGroup(of: UIImage?.self, returning: [UIImage].self) { group in
group.addTask {
// Do SomeThing // ex: 2번 쓰레드 작업됨
}
group.addTask {
// Do SomeThing g // ex: 3번 쓰레드 작업됨
}
for await image in group { // 비동기 반복문이며 ex: 4번 쓰레드 작업됨,Race Condition 해결해줌
if let image = image {
imageArray.append(image)
}
}
}
- groupTask중 먼저 끝나는 순서대로 imageArrayAppend 수행
- group은 내부적으로 task가 끝나는 시점을 알고 있다.
- 부모를 생성하여 task를 관리한다(TaskGroup)
'iOS developer essential skills > Modern Concurency' 카테고리의 다른 글
Modern Concurrency Deep Dive(10) (0) | 2024.11.23 |
---|---|
Modern Concurrency Deep Dive(9) (0) | 2024.11.22 |
Modern Concurrency Deep Dive(7) (0) | 2024.11.20 |
Modern Concurrency Deep Dive(6) (0) | 2024.11.19 |
Modern Concurrency Deep Dive(5) (0) | 2024.11.18 |