---
title: "setTarget(queue:)"
framework: dispatch
role: symbol
role_heading: Instance Method
path: "dispatch/dispatchobject/settarget(queue:)"
---

# setTarget(queue:)

Specifies the dispatch queue on which to perform work associated with the current object.

## Declaration

```swift
func setTarget(queue: dispatch_queue_t?)
```

## Parameters

- `queue`: The new target queue for the object. The new queue is retained, and the previous target queue (if any) is released. Specify NULL if you want the system to provide a queue that is appropriate for the current object.

## Discussion

Discussion The target queue determines the queue on which the object’s finalizer is invoked. In addition, assigning a target queue affects how you deal with some dispatch objects, as described in the following table.  |   |   |   |  important: When setting up target queues, it is a programmer error to create cycles in the dispatch queue hierarchy. In other words, don’t set the target of queue A to queue B and the target of queue B to queue A.
