GCD10: use GCD to build your own dispatch queue

Source: Internet
Author: User
Tags reverse dns
To create your own dispatch queue with a unique name: Use the dispatch_queue_create function.

Discussion:

With GCD, you can create your own serial dispatch queue: We will use the dispatch_queue_create function to create a serial queue. This function The first parameter is a C string (char *),It uniquely identifies the serial queue in the system. The reason why I stress the system is This identifier is a full system identifierThis means that your APP has created a new serial queue with the serialQueue1 identifier, which is the same as the identifier of another APP, GCD cannot determine the result of creating a new serial queue with the same name. Because of this, Apple strongly recommends that you use Identifier in Reverse DNS format, The reverse dns identifier is usually constructed in this way: com. COMPANY. PRODUCT. IDENTIFIER. For example, I can create two serial queues and name them respectively:
Com. pixolity. GCD. serialQueue1 com. pixolity. GCD. serialQueue2
After creating a serial queue, you can use various GCD functions to assign tasks to it. Once the self-created serial queue is used, you must use dispatch_release to release it. Example:

 

 

GCD10: use GCD to build your own dispatch queue

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.