I met the problem is why the following code print out priority is the same? Why is this? Thank you very much.
print("main:\(Thread.current)")
print("thread main priorities:\(Thread.current.threadPriority)")
DispatchQueue.global(qos: .utility).async {
print("utility:\(Thread.current)")
print("thread utility priorities:\(Thread.current.threadPriority)")
}
DispatchQueue.global(qos: .background).async {
print("background:\(Thread.current)")
print("thread background priorities:\(Thread.current.threadPriority)")
}
DispatchQueue.global(qos: .userInteractive).async {
print("userInteractive:\(Thread.current)")
print("thread userInteractive priorities:\(Thread.current.threadPriority)")
}
DispatchQueue.global(qos: .userInitiated).async {
print("userInitiated:\(Thread.current)")
print("thread userInitiated priorities:\(Thread.current.threadPriority)")
}
Log:
main:{number = 1, name = main} thread main priorities:0.5
userInteractive:{number = 3, name = (null)}
utility:{number = 5, name = (null)}
background:{number = 6, name = (null)}
thread userInteractive priorities:0.5
userInitiated:{number = 4, name = (null)}
thread utility priorities:0.5
thread background priorities:0.5
thread userInitiated priorities:0.5