Created
May 25, 2016 22:28
-
-
Save acchou/7ecdee5375fdc8c2d500e479481180c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import RxSwift | |
import RxCocoa | |
let ps = PublishSubject<Int>() | |
func pt() -> String { | |
let thread = NSThread.currentThread() | |
let main = thread.isMainThread ? "[Main] " : "" | |
let qos = currentThreadQos() | |
let tid = pthread_mach_thread_np(pthread_self()) | |
return "[\(tid)] \(main)\(qos)" | |
} | |
ps | |
.subscribeOn(ConcurrentDispatchQueueScheduler(globalConcurrentQueueQOS: .UserInitiated)) | |
.map { | |
print("map \(pt()) \($0)") | |
return $0 | |
} | |
//.observeOn(ConcurrentDispatchQueueScheduler(globalConcurrentQueueQOS: .Utility)) | |
.subscribeNext { (i: Int) in | |
print("subscribe \(pt()) \(i)") | |
} | |
ps.onNext(0) | |
ps.onNext(1) | |
ps.onNext(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment