码迷,mamicode.com
首页 > 其他好文 > 详细

dispatch_sync

时间:2015-06-13 13:02:02      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

dispatch_sync:


 Submits a block to a dispatch queue like dispatch_async(), however

  dispatch_sync() will not return until the block has finished.

 

 Calls to dispatch_sync() targeting the current queue will result in dead-lock.



/*!

 * @function dispatch_get_global_queue

 *

 * @abstract

 * Returns a well-known global concurrent queue of a given quality of service

 * class.

 *

 * @discussion

 * The well-known global concurrent queues may not be modified. Calls to

 * dispatch_suspend(), dispatch_resume(), dispatch_set_context(), etc., will

 * have no effect when used with queues returned by this function.

 *

 * @param identifier

 * A quality of service class defined in qos_class_t or a priority defined in

 * dispatch_queue_priority_t.

 *

 * It is recommended to use quality of service class values to identify the

 * well-known global concurrent queues:

 *  - QOS_CLASS_USER_INTERACTIVE

 *  - QOS_CLASS_USER_INITIATED

 *  - QOS_CLASS_DEFAULT

 *  - QOS_CLASS_UTILITY

 *  - QOS_CLASS_BACKGROUND

 *

 * The global concurrent queues may still be identified by their priority,

 * which map to the following QOS classes:

 *  - DISPATCH_QUEUE_PRIORITY_HIGH:         QOS_CLASS_USER_INITIATED

 *  - DISPATCH_QUEUE_PRIORITY_DEFAULT:      QOS_CLASS_DEFAULT

 *  - DISPATCH_QUEUE_PRIORITY_LOW:          QOS_CLASS_UTILITY

 *  - DISPATCH_QUEUE_PRIORITY_BACKGROUND:   QOS_CLASS_BACKGROUND

 *

 * @param flags

 * Reserved for future use. Passing any value other than zero may result in

 * a NULL return value.

 *

 * @result

 * Returns the requested global queue or NULL if the requested global queue

 * does not exist.

 */

__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)

DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW

dispatch_queue_t

dispatch_get_global_queue(long identifier, unsigned long flags);



dispatch_sync

标签:

原文地址:http://my.oschina.net/u/255456/blog/466321

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!