<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IOService/SetDispatchQueue",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOService@F@SetDispatchQueue#*1C#*$@S@IODispatchQueue#"
  },
  "title" : "SetDispatchQueue"
}
-->

# SetDispatchQueue

Associates a custom dispatch queue with the service and assigns the specified name to it.

```
virtual kern_return_t SetDispatchQueue(const IODispatchQueueName name, IODispatchQueue *queue);
```

## Parameters

`name`

The name to assign to the queue. Use this name with the [`QUEUENAME`](/documentation/DriverKit/QUEUENAME) macro to designate where you want the methods of your class to execute. Include that macro at the end of your method signature methods in the `.iig` file of your class.

`queue`

The queue to associate with the service. The service retains the queue you provide.

## Return Value

[`kIOReturnSuccess`](/documentation/DriverKit/kIOReturnSuccess) on success, or another value if an error occurs. For a list of error codes, see [Error Codes](/documentation/DriverKit/error-codes).

## Discussion

In your driver’s [`Start`](/documentation/DriverKit/IOService/Start) method, call this method once for each unique queue name you designated in your class definition file. This method registers the dispatch queue with that name and assigns it to your service. When calling the methods of your service, DriverKit uses the appropriate dispatch queue. If DriverKit calls a method before you set the dispatch queue that method uses, the method runs on the default queue.

DriverKit creates a default dispatch queue for every service. To replace the default queue that DriverKit provides, call this method and specify `kIOServiceDefaultQueueName` for the `name` parameter.

---

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)