Skip to content

Instantly share code, notes, and snippets.

@wuchuwuyou
Created November 3, 2017 07:42
Show Gist options
  • Save wuchuwuyou/b3508ba876ed5c970525779624c35ac6 to your computer and use it in GitHub Desktop.
Save wuchuwuyou/b3508ba876ed5c970525779624c35ac6 to your computer and use it in GitHub Desktop.
dispath_queue_t
static dispatch_queue_t get_queue() {
static dispatch_queue_t queue;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
dispatch_queue_attr_t attr = DISPATCH_QUEUE_SERIAL;
if (NSFoundationVersionNumber >= NSFoundationVersionNumber_With_QoS_Available) {
attr = dispatch_queue_attr_make_with_qos_class(attr, QOS_CLASS_BACKGROUND, 0);
}
queue = dispatch_queue_create("xxxx.yyy.zzz", attr);
});
return queue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment