Creates a CFMachPort object for a pre-existing native Mach port.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The allocator to use to allocate memory for the new object. Pass
kto use the current default allocator.
The native Mach port to use.
The callback function invoked when a message is received on the Mach port.
A structure holding contextual information for the Mach port. The function copies the information out of the structure, so the memory pointed to by
contextdoes not need to persist beyond the function call.
A flag set by the function to indicate whether the
contextshould be freed. The flag is set to
trueon failure or if a CFMachPort object already exists for
The new CFMachPort object or
NULL on failure. If a CFMachPort object already exists for
port, the function returns the pre-existing object instead of creating a new object; the
callout parameters are ignored in this case. Ownership follows the The Create Rule.
The CFMachPort object does not take full ownership of the send and receive rights of the Mach port
port. It is the caller’s responsibility to deallocate the Mach port rights after the CFMachPort object is no longer needed and has been invalidated.