<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFMachPortSetInvalidationCallBack(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFMachPortSetInvalidationCallBack"
  },
  "title" : "CFMachPortSetInvalidationCallBack(_:_:)"
}
-->

# CFMachPortSetInvalidationCallBack(_:_:)

Sets the callback function invoked when a CFMachPort object is invalidated.

```
func CFMachPortSetInvalidationCallBack(_ port: CFMachPort!, _ callout: CFMachPortInvalidationCallBack!)
```

## Parameters

`port`

The CFMachPort object to modify.

`callout`

The callback function to invoke when `port` is invalidated. Pass `NULL` to remove a callback.

## Discussion

If `port` is already invalid, `callout` is invoked immediately.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)