dispatch_sync

原创
2015/06/13 11:11
阅读数 117

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);



展开阅读全文
打赏
0
1 收藏
分享
加载中
更多评论
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部