---
title: "withTarget(OSObject *, IOOutputAction, IOWorkLoop *, UInt32)"
framework: kernel
role: pseudoSymbol
path: kernel/iogatedoutputqueue/1812954-withtarget
---

# withTarget(OSObject *, IOOutputAction, IOWorkLoop *, UInt32)

Factory method that constructs and initializes an IOGatedOutputQueue object.

## Declaration

```occ
static IOGatedOutputQueue * withTarget(
 OSObject *target, 
 IOOutputAction action, 
 IOWorkLoop *workloop, 
 UInt32 capacity = 0); 
```

## Parameters

- `target`: The object that will handle packets removed from the queue.
- `action`: The function that will handle packets removed from the queue.
- `workloop`: A workloop object. An IOCommandGate object is created and added to this workloop as an event source.
- `capacity`: The initial capacity of the output queue.

## Return Value

Return Value Returns an IOGatedOutputQueue object on success, or 0 otherwise.

## See Also

### Miscellaneous

- [free](kernel/iogatedoutputqueue/1812925-free.md)
- [init](kernel/iogatedoutputqueue/1812930-init.md)
- [output(IOMbufQueue *, UInt32 *)](kernel/iogatedoutputqueue/1812936-output.md)
- [output(void *)](kernel/iogatedoutputqueue/1812941-output.md)
- [scheduleServiceThread](kernel/iogatedoutputqueue/1812945-scheduleservicethread.md)
- [withTarget(IONetworkController *, IOWorkLoop *, UInt32)](kernel/iogatedoutputqueue/1812948-withtarget.md)
- [withTarget(IONetworkController *, IOWorkLoop *, UInt32, UInt32)](kernel/iogatedoutputqueue/1812950-withtarget.md)
- [withTarget(OSObject *, IOOutputAction, IOWorkLoop *, UInt32, UInt32)](kernel/iogatedoutputqueue/1812957-withtarget.md)
