ios - Queue of 2 background processes -


i need create queue of 2 background processes work synchronously.

i trying code not it. mistake?

dispatch_sync(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{   //block1   dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_background, 0), ^{     //block2   }); }); 

if understand question, need create serial queue if want blocks run synchronously:

dispatch_queue_t queue = dispatch_queue_create("queue-name", dispatch_queue_serial); dispatch_async(queue, ^{   // first block }); dispatch_async(queue, ^{   // second block }); 

both these blocks run on unnamed background thread, run synchronously. first block finish executing before second block begins.

you don't want use background priority. queue run backed default priority global queue, want.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -