摘要: 原帖地址:http://www.dreamingwish.com/dream-2012/gcd-four-the-the-odds-and-ends.htmlDispatch Queue挂起dispatch queue可以被挂起和恢复。使用dispatch_suspend函数来挂起,使用 dispatch_resume函数来恢复。这两个函数的行为是如你所愿的。另外,这两个还是也可以用于dispatch source。一个要注意的地方是,dispatch queue的挂起是block粒度的。换句话说,挂起一个queue并不会将当前正在执行的block挂起。它会允许当前执行的block执行完毕,然 阅读全文
posted @ 2013-04-09 17:59 BankFish 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 原帖地址:http://www.dreamingwish.com/dream-2012/intro-to-grand-central-dispatch-part-iii-the-dispatch-sources.html何为Dispatch Sources简单来说,dispatch source是一个监视某些类型事件的对象。当这些事件发生时,它自动将一个block放入一个dispatch queue的执行例程中。说的貌似有点不清不楚。我们到底讨论哪些事件类型?下面是GCD 10.6.0版本支持的事件:Mach port send right state changes.Mach port re 阅读全文
posted @ 2013-04-09 17:58 BankFish 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 原帖地址:http://www.dreamingwish.com/dream-2012/of-of-of-performance-of-of-of-of-of-of-of-gcd-introduced-ba-the-multi-core.html概念为了在单一进程中充分发挥多核的优势,我们有必要使用多线程技术(我们没必要去提多进程,这玩意儿和GCD没关系)。在低层,GCD全局dispatch queue仅仅是工作线程池的抽象。这些队列中的Block一旦可用,就会被dispatch到工作线程中。提交至用户队列的Block最终也会通过全局队列进入相同的工作线程池(除非你的用户队列的目标是主线程,但 阅读全文
posted @ 2013-04-09 17:57 BankFish 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 原帖地址:http://www.dreamingwish.com/dream-2012/of-of-of-of-gcd-introduced-1-basic-concepts-in-and-the-dispatch-queue.htmlGCD(Grand Central Dispatch) : 低层API, 提供新的并发程序编写方法,类似NSOperationQueue, 允许程序将任务切分为多个单一任务后提交至工作队列并发或串行执行。 比之NSOperationQueue更底层更高效,不是Cocoa Framework的一部分。 提供高度集成的事件控制系统,可设置句柄来响应文件描述符、... 阅读全文
posted @ 2013-04-09 17:23 BankFish 阅读(187) 评论(0) 推荐(0) 编辑