objective c - Can thread be used analogously with queue, or do they mean separate things? -
i reading through this great tutorial when came accross following line (as background: learning how use dispatch_apply
replace for
loop , concurrently download photos):
be aware although have code add photos in thread safe manner, ordering of images different depending on thread finishes first.
this line threw me off reason. thought dispatch_apply
run task on 1 concurrent thread, globaluserinitiatedqueue
, not multiple different threads. calls method saying:
dispatch_apply(addresses.count, globaluserinitiatedqueue) {
so globaluserinitiatedqueue
1 thread, multiple threads, , what's difference between thread , queue? seems, they're used analogously. mean concurrent queue has multiple threads running @ same time?
thanks -
from guide:
"concurrent queues (also known type of global dispatch queue) execute 1 or more tasks concurrently, tasks still started in order in added queue. executing tasks run on distinct threads managed dispatch queue. exact number of tasks executing @ given point variable , depends on system conditions."
it can't clearer that. multiple threads, start in order of tasks on queue finishing in no specific order.
i love tutorials , material aim explains stuff in great details. however, when in doubts, go apple official documentations.
Comments
Post a Comment