dispatch_release & dispatch_retain

sdk6.0以前不管arc或者none-arc都需要手动retain和release GCD 对象。

sdk6.0以后GCD对象可以有arc处理。不需要手动retain和release。

#if !OS_OBJECT_USE_OBJC   //这个宏是在sdk6.0之后才有的,如果是之前的,则OS_OBJECT_USE_OBJC为0

dispatch_release(gcd_obj);

#endif

时间: 2024-08-14 10:34:03

dispatch_release & dispatch_retain的相关文章

GCD

Grand Central Dispatch (GCD)是Apple开发的一个多核编程的解决方法. dispatch queue分成以下三种: 1)运行在主线程的Main queue,通过dispatch_get_main_queue获取. /*! * @function dispatch_get_main_queue * * @abstract * Returns the default queue that is bound to the main thread. * * @discussi

iOS多线程 GCD

iOS多线程 GCD Grand Central Dispatch (GCD)是Apple开发的一个多核编程的解决方法. dispatch queue分成以下三种: 1)运行在主线程的Main queue,通过dispatch_get_main_queue获取. /*! * @function dispatch_get_main_queue * * @abstract * Returns the default queue that is bound to the main thread. *

iOS之GCD的局部解析

一什么是GCD :(Grand [伟大] Central [中央]  Dispatch[调度]) GCD又名“伟大的中央调度器”,他是iOS4后才引进的一种多线程技术.开发者只需定义想执行的任务兵追加到Dispatch Queue(调度队列)中.GCD就能生成必要的线程并有计划的执行任务.GCD的实质其实就是队列. 二GCD的优势 1.GCD的出现解决了多核并行运算的问题 2.GCD自动管理线程的生命周期 3.只需描写任务,无需编写任何线程管理的代码 注:由dispatch_queue_crea

iOS-GCD用法

Grand Central Dispatch (GCD)是Apple开发的一个多核编程的解决方法. dispatch queue分成以下三种: 1)运行在主线程的Main queue,通过dispatch_get_main_queue获取. 可以看出,dispatch_get_main_queue也是一种dispatch_queue_t. 2)并行队列global dispatch queue,通过dispatch_get_global_queue获取,由系统创建三个不同优先级的dispatch

GCD介绍(转)

GCD介绍(一): 基本概念和Dispatch Queue GCD提供很多超越传统多线程编程的优势: 易用: GCD比之thread跟简单易用.由于GCD基于work unit而非像thread那样基于运算,所以GCD可以控制诸如等待任务结束.监视文件描述符.周期执行代码以及工作挂起等任务.基于block的血统导致它能极为简单得在不同代码作用域之间传递上下文. 效率: GCD被实现得如此轻量和优雅,使得它在很多地方比之专门创建消耗资源的线程更实用且快速.这关系到易用性:导致GCD易用的原因有一部

GCD多线程的使用(二)

记录一下GCD的几个重要API的用法. dispatch_queue_create * @param label * A string label to attach to the queue. * This parameter is optional and may be NULL. * * @param attr * DISPATCH_QUEUE_SERIAL or DISPATCH_QUEUE_CONCURRENT. * * @result * The newly created disp

GCD基本概念和Dispatch Queue

什么是GCD? Grand Central Dispatch或者GCD,是?一套低层API,提供了?一种新的?方法来进?行并发程序编写.从基本功能上讲,GCD有点像NSOperationQueue,他们都允许程序将 任务切分为多个单?一任务然后提交?至?工作队列来并发地或者串?行地执?行.GCD?比之NSOpertionQueue更底层更?高效,并且它不是Cocoa框架的?一部分. 除了代码的平?行执?行能?力,GCD还提供?高度集成的事件控制系统.可以设置句柄来响应?文件描述符.mach po

IOS线程

一, iOS有三种多线程编程的技术,分别是: 1..NSThread 2.Cocoa NSOperation (iOS多线程编程之NSOperation和NSOperationQueue的使用) 3.GCD  全称:Grand Central Dispatch( iOS多线程编程之Grand Central Dispatch(GCD)介绍和使用) 这三种编程方式从上到下,抽象度层次是从低到高的,抽象度越高的使用越简单,也是Apple最推荐使用的. 二,NSThread 1. [NSThread 

iOS多线程GCD

Grand Central Dispatch (GCD)是Apple开发的一个多核编程的解决方法. dispatch queue分成以下三种: 1)运行在主线程的Main queue,通过dispatch_get_main_queue获取. /*! * @function dispatch_get_main_queue * * @abstract * Returns the default queue that is bound to the main thread. * * @discussi