---
title: "makeMachReceiveSource(port:queue:)"
framework: dispatch
role: symbol
role_heading: Type Method
path: "dispatch/dispatchsource/makemachreceivesource(port:queue:)"
---

# makeMachReceiveSource(port:queue:)

Creates a new dispatch source object for monitoring a Mach port for pending messages.

## Declaration

```swift
class func makeMachReceiveSource(port: mach_port_t, queue: DispatchQueue? = nil) -> any DispatchSourceMachReceive
```

## Parameters

- `port`: A Mach port with a receive right.
- `queue`: The dispatch queue to use when executing the installed handlers.

## Return Value

Return Value A dispatch source object that conforms to the DispatchSourceMachReceive protocol.

## Discussion

Discussion After creating the dispatch source, use the methods of the DispatchSourceProtocol protocol to install the event handlers you need. The returned dispatch source is in the inactive state initially. When you are ready to begin processing events, call its activate() method.

## See Also

### Creating a Mach Port Source

- [makeMachSendSource(port:eventMask:queue:)](dispatch/dispatchsource/makemachsendsource(port:eventmask:queue:).md)
- [DispatchSourceMachReceive](dispatch/dispatchsourcemachreceive.md)
- [DispatchSourceMachSend](dispatch/dispatchsourcemachsend.md)
- [DispatchSource.MachSendEvent](dispatch/dispatchsource/machsendevent.md)
