I need to do a validation and for this I need to know if the task is still running i use this code for launch the task
` SerialQueue = dispatch_queue_create("miColaEnSerie", NULL);
dispatch_async(SerialQueue, ^{
[self loadImageFriend:init finalWhitNumber:final img1WithArray:infoImages1 img2WithArray:infoImages2 img3WithArray:infoImages3];
});`
If you have only one task at a time in your SerialQueue then you can add atomic property to a class like:
Then:
If however there are more tasks you add to SerialQueue you could change
BOOL isSerialQueueRunningtoNSInteger serialQueueTasksand increment/decrement it accordingly. Then verify if it’s 0 which means nothing is in the queue at the moment.Sometimes it’s better to implement notifications to get information when the task is done and perform some action after that.