ios多线程边学边杂记

dispatch_queue_t dispatch_queue_create(const char *label, dispatch_queue_attr_t attr);

该方法创建一个新的代码块可以提交的调度队列(Creates a new dispatch queue to which blocks can be submitted.

label

A string label to attach to the queue to uniquely identify it in debugging tools such as Instruments,sample, stackshots, and crash reports. Because applications, libraries, and frameworks can all create their own dispatch queues, a reverse-DNS naming style (com.example.myqueue) is recommended. This parameter is optional and can be NULL.

attr

In OS X v10.7 and later or iOS 4.3 and later, specifyDISPATCH_QUEUE_SERIAL (or NULL) to create a serial queue or specifyDISPATCH_QUEUE_CONCURRENT to create a concurrent queue. In earlier versions, you must specify NULL for this parameter.


void dispatch_suspend(dispatch_object_t object);

该方法对一个调度对象延缓其代码块对象的调用。(Suspends the invocation of block objects on a dispatch object.

object

The dispatch queue or dispatch source to suspend. (You cannot suspend other types of dispatch objects.) This parameter cannot be NULL.



void dispatch_set_context(dispatch_object_t object, void *context);

该方法将程序定义的上下文与调用对象联系起来。(Associates an application-defined context with the object.

object

This parameter cannot be NULL.

context

The new application-defined context for the object. This can be NULL.


void dispatch_set_finalizer_f(dispatch_object_t object, dispatch_function_t finalizer);

该方法为一个调度对象设置终结器功能。(Sets the finalizer function for a dispatch object.

object

The dispatch object to modify. This parameter cannot be NULL.

finalizer

The finalizer function pointer.


dispatch_queue_t dispatch_get_globle_queue(long identifier, unsigned long flags);

该方法返回一个系统定义的全局的当前队列(该队列用服务类的制定特性)。

identifier

The quality of service you want to give to tasks executed using this queue. Quality-of-service helps determine the priority given to tasks executed by the queue. You may specify the values QOS_CLASS_USER_INTERACTIVE,QOS_CLASS_USER_INITIATED,QOS_CLASS_UTILITY, orQOS_CLASS_BACKGROUND. Queues that handle user-interactive or user-initiated tasks have a higher priority than tasks meant to run in the background.

You may also specify one of the dispatch queue priority values, which are found indispatch_queue_priority_t. These values map to an appropriate quality-of-service class.

flags

Flags that are reserved for future use. Always specify 0 for this parameter.


void dispatch_async(dispatch_queue_t queue, dispatch_block_t block);

该方法在一个调度队列中异步提交一个代码块,并且立刻返回。

queue

The queue on which to submit the block. The queue is retained by the system until the block has run to completion. This parameter cannot be NULL.

block

The block to submit to the target dispatch queue. This function performs Block_copy and Block_releaseon behalf of callers. This parameter cannot be NULL.


void dispatch_async_f(dispatch_queue_t queue, void *context, dispatch_function_t work);

该方法在一个调度队列中异步提交一个程序定义的函数,并且立刻返回。

queue

The queue on which to submit the function. The queue is retained by the system until the function has run to completion. This parameter cannot be NULL.

context

The application-defined context parameter to pass to the function.

work

The application-defined function to invoke on the target queue. The first parameter passed to this function is the value of the contextparameter. This parameter cannot be NULL.


void dispatch_resume(dispatch_object object);

在一个调度对象上重新调用代码块对象。

object

The object to be resumed. This parameter cannot beNULL.




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值