<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UnownedSerialExecutor/init(complexEquality:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:Sce15complexEqualityScexh_tcScfRzlufc"
  },
  "title" : "init(complexEquality:)"
}
-->

# init(complexEquality:)

Opts the executor into complex “same exclusive execution context” equality checks.

```
init<E>(complexEquality executor: E) where E : SerialExecutor
```

## Discussion

This means what when asserting or assuming executors, and the current and expected
executor are not the same instance (by object equality), the runtime may invoke
`isSameExclusiveExecutionContext` in order to compare the executors for equality.

Implementing such complex equality can be useful if multiple executor instances
actually use the same underlying serialization context and can be therefore
safely treated as the same serial exclusive execution context (e.g. multiple
dispatch queues targeting the same serial queue).

---

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)