<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/dispatch_queue_attr_make_with_qos_class",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "c:@F@dispatch_queue_attr_make_with_qos_class"
  },
  "title" : "dispatch_queue_attr_make_with_qos_class"
}
-->

# dispatch_queue_attr_make_with_qos_class

Returns attributes suitable for creating a dispatch queue with the desired quality-of-service information.

```
extern dispatch_queue_attr_tdispatch_queue_attr_make_with_qos_class(dispatch_queue_attr_t attr, dispatch_qos_class_t qos_class, int relative_priority);
```

## Parameters

`attr`

A queue attribute value to be combined with the quality-of-service class. Specify [`DISPATCH_QUEUE_SERIAL`](/documentation/Dispatch/DISPATCH_QUEUE_SERIAL) if you want submitted tasks to be scheduled serially or [`DISPATCH_QUEUE_CONCURRENT`](/documentation/Dispatch/DISPATCH_QUEUE_CONCURRENT) if tasks may be scheduled concurrently. If you specify `NULL`, this function creates a serial queue.

`qos_class`

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. Specify one of the values `QOS_CLASS_USER_INTERACTIVE`, `QOS_CLASS_USER_INITIATED`, `QOS_CLASS_UTILITY`, or `QOS_CLASS_BACKGROUND`. Queues that handle user-interactive or user-initiated tasks have a higher priority than tasks meant to run in the background.

`relative_priority`

A negative offset from the maximum supported scheduler priority for the given quality-of-service class. This value must be less than `0` and greater than or equal to `QOS_MIN_RELATIVE_PRIORITY`, or else this function returns `NULL`.

## Return Value

An attribute value that may be passed to the [`dispatch_queue_create`](/documentation/Dispatch/dispatch_queue_create) function when creating a dispatch queue.

## Discussion

Call this function prior to calling the [`dispatch_queue_create`](/documentation/Dispatch/dispatch_queue_create) function when you want to create a dispatch queue with a specific quality-of-service level. This function combines the queue type attributes with the quality-of-service information you specify and returns a value that you can pass to the [`dispatch_queue_create`](/documentation/Dispatch/dispatch_queue_create) function. The quality-of-service value you specify using this function takes precedence over the priority level inherited from the dispatch queue’s target queue.

The global queue priorities map to the following quality-of-service classes:

- [`DISPATCH_QUEUE_PRIORITY_HIGH`](/documentation/Dispatch/DISPATCH_QUEUE_PRIORITY_HIGH) maps to the `QOS_CLASS_USER_INITIATED` class.
- [`DISPATCH_QUEUE_PRIORITY_DEFAULT`](/documentation/Dispatch/DISPATCH_QUEUE_PRIORITY_DEFAULT) maps to the `QOS_CLASS_DEFAULT` class.
- [`DISPATCH_QUEUE_PRIORITY_LOW`](/documentation/Dispatch/DISPATCH_QUEUE_PRIORITY_LOW) maps to the `QOS_CLASS_UTILITY` class.
- [`DISPATCH_QUEUE_PRIORITY_BACKGROUND`](/documentation/Dispatch/DISPATCH_QUEUE_PRIORITY_BACKGROUND) maps to the `QOS_CLASS_BACKGROUND` class.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)