<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Hypervisor",
  "identifier" : "/documentation/Hypervisor/hv_vcpu_run_until(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Hypervisor"
    ],
    "preciseIdentifier" : "c:@F@hv_vcpu_run_until"
  },
  "title" : "hv_vcpu_run_until(_:_:)"
}
-->

# hv_vcpu_run_until(_:_:)

Executes a vCPU until it reaches the deadline defined in absolute time units you provide.

```
func hv_vcpu_run_until(_ vcpu: hv_vcpuid_t, _ deadline: UInt64) -> hv_return_t
```

## Parameters

`vcpu`

The instance of the vCPU.

`deadline`

The timer deadline in mach absolute time units. Use the special value [`HV_DEADLINE_FOREVER`](/documentation/Hypervisor/HV_DEADLINE_FOREVER) to specify a deadline that never expires.

## Return Value

[`HV_SUCCESS`](/documentation/Hypervisor/HV_SUCCESS) if the operation was successful, otherwise an error code specified in [`hv_return_t`](/documentation/Hypervisor/hv_return_t).

## Discussion

If the deadline you specify is other than [`HV_DEADLINE_FOREVER`](/documentation/Hypervisor/HV_DEADLINE_FOREVER), this call uses the VMX preemption timer. If the hardware doesn’t support the VMX preemption timer, it returns [`HV_UNSUPPORTED`](/documentation/Hypervisor/HV_UNSUPPORTED).

This function supersedes [`hv_vcpu_run(_:)`](/documentation/Hypervisor/hv_vcpu_run(_:)) on Intel-based Mac computers. Unlike [`hv_vcpu_run(_:)`](/documentation/Hypervisor/hv_vcpu_run(_:)), it doesn’t return on transparently handled VMEXITs.

---

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)