<!--
{
  "availability" : [
    "iOS: 2.0.0 - 26.0.0",
    "iPadOS: 2.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.0.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 2.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSNotification/Name-swift.struct/NSThreadWillExit",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@NSThreadWillExitNotification"
  },
  "title" : "NSThreadWillExit"
}
-->

# NSThreadWillExit

An `NSThread` object posts this notification when it receives the [`exit()`](/documentation/Foundation/Thread/exit()) message, before the thread exits. Observer methods invoked to receive this notification execute in the exiting thread, before it exits.

```
static let NSThreadWillExit: NSNotification.Name
```

## Discussion

The notification object is the exiting `NSThread` object. This notification does not contain a `userInfo` dictionary.

---

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)