<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAudio",
  "identifier" : "/documentation/CoreAudio/AudioHardwareDevice/toggleHogMode()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Audio"
    ],
    "preciseIdentifier" : "s:9CoreAudio0B14HardwareDeviceC13toggleHogModes5Int32VyKF"
  },
  "title" : "toggleHogMode()"
}
-->

# toggleHogMode()

Toggle exclusive access to the device for the current process. If another process owns
exclusive access, that remains unchanged. If the current process owns exclusive access,
it is released and made available to all processes again. If no process has exclusive
access, this process gains ownership of exclusive access.

```
func toggleHogMode() throws -> pid_t
```

## Return Value

A pid_t indicating the process that currently owns exclusive access to the
device or a value of -1 indicating that the device is currently available to all processes.

---

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)