NSAutoreleasePool * pool = [[NSAutoreleasePoolalloc] init];
const char* queueName = [[[NSDatedate] description] UTF8String];
dispatch_queue_t myQueue = dispatch_queue_create(queueName, NULL);
dispatch_queue_t mainQueue = dispatch_get_main_queue();
dispatch_async(myQueue, ^{
//新线程中要操作的(例如数据库的读取,存储等)
dispatch_async(mainQueue, ^{
//主线程中要操作的(例如UI页面刷新)
});
});
dispatch_release(myQueue);
dispatch_release(mainQueue);
[pool drain];