Creates and returns a port object configured with the specified options and the given Mach port.
SDKs
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
class func port(withMachPort machPort: UInt32, options f: NSMach Port.Options = []) -> Port
Parameters
machPort
The Mach port for the new port. This parameter should originally be of type mach_port_t.
options
Specifies options for what to do with the underlying port rights when the
NSMach
object is invalidated or destroyed. For a list of constants, see Mach Port Rights.Port
Return Value
An NSMach
object that uses mach
to send or receive messages.
Discussion
Creates the port object if necessary. Depending on the access rights associated with mach
, the new port object may be usable only for sending messages.