I am learning GCD
and I am wondering if the following is OK or:
is there a better way to do?
I am also wondering if I need to weakify self
in what follows. I am using ARC
.
id someObject = [self getSomeObject] ;
dispatch_queue_t newThread = dispatch_queue_create("New thread", NULL) ;
dispatch_async(newThread, ^
{
[self doSomeStuff] ;
[someObject doSomeStuffOnMyObject] ;
/*
Back on the main thread
*/
dispatch_async(dispatch_get_main_queue(), ^
{
[self doSomeStuffMore] ;
[someObject doSomeStuffOnMyObjectMore] ;
}) ;
}) ;
So, if this is the good way to do, should I create a category over NSObject
?