I started to learn programming for iOS and I want to find out how to implement next Java functions with threads in Swi
For 2
, I would use serial queue:
dispatch_queue_t myQueue;
And implement my queue as of below:
myQueue = dispatch_queue_create("my_serial_queue", DISPATCH_QUEUE_SERIAL);
dispatch_async(myQueue, ^{
for (int i = 0; i < 10000; i++) {
usleep(100);
}
NSLog(@"Task 1 done");
});
dispatch_async(myQueue, ^{
NSLog(@"Task 2 done");
});