i have four operations to be done as follows
- start actvityindicator.
- do some caclulations. (in bg thread)
- save the results in xml .(in bg thread)
- stop the actvityindicator.
Now I am doing these operations in GCD as follows.
[self showAlert];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self calculateValues];
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
[utility createXMLWithName:name];
dispatch_sync(dispatch_get_main_queue(), ^{
[self hideAlert];
});
});
});
I want to confirm is this the right way to do this in GCD? I need the task 2 and 3 in bg and also task 3 should happen only after task 2 finishes. For that i put the task 2 and 3 in separate queues.