Creates a CFMachPort object with a new Mach port.


func CFMachPortCreate(_ allocator: CFAllocator!, _ callout: CFMachPortCallBack!, _ context: UnsafeMutablePointer<CFMachPortContext>!, _ shouldFreeInfo: UnsafeMutablePointer<DarwinBoolean>!) -> CFMachPort!



The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.


The callback function invoked when a message is received on the new Mach port.


A structure holding contextual information for the new Mach port. The function copies the information out of the structure, so the memory pointed to by context does not need to persist beyond the function call.


A flag set by the function to indicate whether the info member of context should be freed. The flag is set to true on failure, false otherwise. shouldFreeInfo can be NULL.

Return Value

The new CFMachPort object or NULL on failure. The CFMachPort object has both send and receive rights. Ownership follows the The Create Rule.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software