¡@

Home 

2014/10/15 ¤U¤È 10:13:21

iphone Programming Glossary: request_queue

Grand Central Dispatch (GCD) with CoreData

http://stackoverflow.com/questions/4264540/grand-central-dispatch-gcd-with-coredata

Here's my scenario along with relevant question dispatch_queue_t main_queue dispatch_get_main_queue dispatch_queue_t request_queue dispatch_queue_create com.app.request NULL dispatch_async request_queue ^ MyNSManagedObject mObject self.fetchedResultsController.. dispatch_get_main_queue dispatch_queue_t request_queue dispatch_queue_create com.app.request NULL dispatch_async request_queue ^ MyNSManagedObject mObject self.fetchedResultsController objectAtIndexPath NSIndexPath indexPathForRow 0 inSection 0 heavy.. a call to dispatch_sync on the main thread. dispatch_queue_t main_queue dispatch_get_main_queue dispatch_queue_t request_queue dispatch_queue_create com.app.request NULL __block __typeof__ self blockSelf self dispatch_async request_queue ^ MyNSManagedObject..

Core Data and threads / Grand Central Dispatch

http://stackoverflow.com/questions/7540801/core-data-and-threads-grand-central-dispatch

mainThreadContextStoreCoordinator self.mainThreadContext persistentStoreCoordinator dispatch_queue_t request_queue dispatch_queue_create com.yourapp.DescriptionOfMethod NULL dispatch_async request_queue ^ Create a new managed object context.. dispatch_queue_t request_queue dispatch_queue_create com.yourapp.DescriptionOfMethod NULL dispatch_async request_queue ^ Create a new managed object context Set its persistent store coordinator NSManagedObjectContext newMoc NSManagedObjectContext.. and call the method below BOOL success newMoc save error if success Deal with error newMoc release dispatch_release request_queue And in response to the context save notification void mergeChanges NSNotification notification dispatch_async dispatch_get_main_queue..