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, |
---|---|
attr | In OS X v10.7 and later or iOS 4.3 and later, specifyDISPATCH_QUEUE_SERIAL (or |
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 |
---|
void dispatch_set_context(dispatch_object_t object, void *context);
该方法将程序定义的上下文与调用对象联系起来。(Associates an application-defined context with the object.)
object | This parameter cannot be |
---|---|
context | The new application-defined context for the object. This can be |
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 |
---|---|
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 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 |
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 |
---|---|
block | The block to submit to the target dispatch queue. This function performs |
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 |
---|---|
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 |
void dispatch_resume(dispatch_object object);
在一个调度对象上重新调用代码块对象。
object | The object to be resumed. This parameter cannot be |
---|