티스토리 뷰
GCD 란
멀티코어 프로세서를 위한 Thread 프로그래밍을 Mac OS 에서 자동으로
관리 / 분배해주는 C Library 이다.
Serial Queue
let queue = DispatchQueue.init(label: "serialQueue")
for i in 1...5 {
queue.async {
Thread.sleep(forTimeInterval: 1)
print("\(i)")
}
}
Concurrent Queue
let queue = DispatchQueue.init(label: "concurrentQueue",
attributes: .concurrent)
for i in 1...5 {
queue.async {
Thread.sleep(forTimeInterval: 1)
print("\(i)")
}
}
Global Queue
let queue = DispatchQueue.global()
for i in 1...5 {
queue.async {
Thread.sleep(forTimeInterval: 1)
print("\(i)")
}
}
Main Queue
let queue = DispatchQueue.main
for i in 1...5 {
queue.async {
Thread.sleep(forTimeInterval: 1)
print("\(i)")
}
}
'iOS 개발 > Swift' 카테고리의 다른 글
| [Swift 3] DispatchGroup 사용하기 (0) | 2017.06.09 |
|---|---|
| [Swift] Objective C 프로젝트에서 Swift 를, Swift 프로젝트에서 Objective C 를 사용하기 (1) | 2017.06.08 |
| [Swift] Singleton Pattern 구현하기 (0) | 2017.06.06 |
| [Swift 3] 확장 (Extensions) (0) | 2017.04.22 |
| [Swift 3] 중첩 타입 (Nested Types) (0) | 2017.04.21 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- RunLoop
- NSManagedObjectModel
- optional
- NSManagedObjectContext
- dictionary
- EffectiveObjectiveC
- coredata
- Arc
- UIView
- AWS
- 읽기 좋은 코드가 좋은 코드다
- Swift3
- set
- CGImage
- workerThread
- NSManagedObject
- thread
- CIImage
- Swift 3.0
- Swift 3
- delegate
- ios
- Swfit
- Block
- Swift
- 꺼내먹어요
- HTTP
- applicationWillResignActive
- string
- docker
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
글 보관함